]> git.sur5r.net Git - openldap/commitdiff
Back out new pthread changes from RE21, needs more work
authorKurt Zeilenga <kurt@openldap.org>
Tue, 17 Sep 2002 20:50:38 +0000 (20:50 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 17 Sep 2002 20:50:38 +0000 (20:50 +0000)
build/openldap.m4
configure
configure.in
include/portable.h.in
libraries/libldap_r/thr_posix.c

index 8369493b66bb59f8ab4ef0e352fd1d52ab167e9b..c50acd4a96a65e3b50aabac3c009be72dd876f77 100644 (file)
@@ -621,47 +621,36 @@ dnl
 dnl ====================================================================
 dnl Check POSIX Thread version 
 dnl
-dnl defines ol_cv_pthread_version to 4, 5, 6, 7, 10, depending on the
-dnl    version of the POSIX.4a Draft that is implemented.
-dnl    10 == POSIX.4a Final == POSIX.1c-1996 for our purposes.
-dnl    Existence of pthreads.h should be tested separately.
-dnl
-dnl tests:
-dnl    pthread_yield() was dropped in Draft 9, so
-dnl            only a Draft <= 8 library will define this
-dnl    pthread_detach() was dropped in Draft 8, it is present
-dnl            in every other version
-dnl    PTHREAD_CREATE_UNDETACHED is only in Draft 7, it was called
-dnl            PTHREAD_CREATE_JOINABLE after that
-dnl    pthread_attr_default was dropped in Draft 6, only 4 and 5 have it
-dnl    PTHREAD_MUTEX_INITIALIZER was introduced in Draft 5. It's not
-dnl            interesting to us because we don't try to statically
-dnl            initialize mutexes. 5-10 has it.
-dnl    pthread_attr_create was renamed to pthread_attr_init in Draft 6.
-dnl            Draft 6-10 has _init, Draft 4-5 has _create.
-dnl
-dnl Draft 9 and 10 are equivalent for our purposes.
+dnl defines ol_cv_posix_version to 'final' or 'draft' or 'unknown'
+dnl    'unknown' implies that the version could not be detected
+dnl            or that pthreads.h does exist.  Existance of pthreads.h
+dnl            should be tested separately.
 dnl
 AC_DEFUN([OL_POSIX_THREAD_VERSION],
 [AC_CACHE_CHECK([POSIX thread version],[ol_cv_pthread_version],[
-       AC_EGREP_HEADER(pthread_yield,pthread.h,[
-       AC_EGREP_HEADER(pthread_detach,pthread.h,[
-       AC_EGREP_CPP(draft7,[
+       AC_EGREP_CPP(pthread_version_final,[
 #              include <pthread.h>
-#              ifdef PTHREAD_CREATE_UNDETACHED
-               draft7
+               /* this check could be improved */
+#              ifdef PTHREAD_ONCE_INIT
+                       pthread_version_final;
 #              endif
-       ], ol_cv_pthread_version=7, [
-       AC_EGREP_HEADER(pthread_attr_default,pthread.h,[
-       AC_EGREP_CPP(draft5,[
+       ], ol_pthread_final=yes, ol_pthread_final=no)
+
+       AC_EGREP_CPP(pthread_version_draft4,[
 #              include <pthread.h>
-#ifdef         PTHREAD_MUTEX_INITIALIZER
-               draft5
-#endif
-       ], ol_cv_pthread_version=5, ol_cv_pthread_version=4) ],
-       ol_cv_pthread_version=6) ]) ],
-       ol_cv_pthread_version=8) ],
-       ol_cv_pthread_version=10)
+               /* this check could be improved */
+#              ifdef pthread_once_init
+                       pthread_version_draft4;
+#              endif
+       ], ol_pthread_draft4=yes, ol_pthread_draft4=no)
+
+       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
 ])
 ])dnl
 dnl
@@ -669,9 +658,6 @@ dnl --------------------------------------------------------------------
 AC_DEFUN([OL_PTHREAD_TEST_INCLUDES],
 [/* pthread test headers */
 #include <pthread.h>
-#if HAVE_PTHREADS < 7
-#include <errno.h>
-#endif
 #ifndef NULL
 #define NULL (void*)0
 #endif
@@ -684,43 +670,60 @@ static void *task(p)
 ])
 AC_DEFUN([OL_PTHREAD_TEST_FUNCTION],[
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
index 29160a56c06226d2324ed39e4198696df3bd7ace..b44edb36e9cab2d044ef1d96c48d9cafbef5533a 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # $OpenLDAP$
-# from OpenLDAP: pkg/ldap/configure.in,v 1.408.2.12 2002/09/06 01:46:19 kurt Exp  
+# from OpenLDAP: pkg/ldap/configure.in,v 1.408.2.13 2002/09/17 02:45:05 kurt Exp  
 
 # Copyright 1998-2002 The OpenLDAP Foundation.  All Rights Reserved.
 # 
@@ -11672,97 +11672,68 @@ else
        cat > conftest.$ac_ext <<EOF
 #line 11674 "configure"
 #include "confdefs.h"
-#include <pthread.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pthread_yield" >/dev/null 2>&1; then
-  rm -rf conftest*
-  
-       cat > conftest.$ac_ext <<EOF
-#line 11683 "configure"
-#include "confdefs.h"
-#include <pthread.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pthread_detach" >/dev/null 2>&1; then
-  rm -rf conftest*
-  
-       cat > conftest.$ac_ext <<EOF
-#line 11692 "configure"
-#include "confdefs.h"
 
 #              include <pthread.h>
-#              ifdef PTHREAD_CREATE_UNDETACHED
-               draft7
+               /* this check could be improved */
+#              ifdef PTHREAD_ONCE_INIT
+                       pthread_version_final;
 #              endif
        
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "draft7" >/dev/null 2>&1; then
+  egrep "pthread_version_final" >/dev/null 2>&1; then
   rm -rf conftest*
-  ol_cv_pthread_version=7
+  ol_pthread_final=yes
 else
   rm -rf conftest*
-  
-       cat > conftest.$ac_ext <<EOF
-#line 11709 "configure"
-#include "confdefs.h"
-#include <pthread.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pthread_attr_default" >/dev/null 2>&1; then
-  rm -rf conftest*
-  
+  ol_pthread_final=no
+fi
+rm -f conftest*
+
+
        cat > conftest.$ac_ext <<EOF
-#line 11718 "configure"
+#line 11696 "configure"
 #include "confdefs.h"
 
 #              include <pthread.h>
-#ifdef         PTHREAD_MUTEX_INITIALIZER
-               draft5
-#endif
+               /* this check could be improved */
+#              ifdef pthread_once_init
+                       pthread_version_draft4;
+#              endif
        
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "draft5" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ol_cv_pthread_version=5
-else
-  rm -rf conftest*
-  ol_cv_pthread_version=4
-fi
-rm -f conftest*
-else
-  rm -rf conftest*
-  ol_cv_pthread_version=6
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-else
+  egrep "pthread_version_draft4" >/dev/null 2>&1; then
   rm -rf conftest*
-  ol_cv_pthread_version=8
-fi
-rm -f conftest*
+  ol_pthread_draft4=yes
 else
   rm -rf conftest*
-  ol_cv_pthread_version=10
+  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 != 0 ; then
-                       cat >> confdefs.h <<EOF
-#define HAVE_PTHREADS $ol_cv_pthread_version
+               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
@@ -11774,12 +11745,12 @@ EOF
 
                
        echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:11778: checking for LinuxThreads pthread.h" >&5
+echo "configure:11749: 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 11783 "configure"
+#line 11754 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 EOF
@@ -11806,12 +11777,12 @@ EOF
 
                
        echo $ac_n "checking for GNU Pth pthread.h""... $ac_c" 1>&6
-echo "configure:11810: checking for GNU Pth pthread.h" >&5
+echo "configure:11781: 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 11815 "configure"
+#line 11786 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 #ifdef _POSIX_THREAD_IS_GNU_PTH
@@ -11840,17 +11811,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:11844: checking for $ac_hdr" >&5
+echo "configure:11815: 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 11849 "configure"
+#line 11820 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:11825: \"$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*
@@ -11880,20 +11851,17 @@ done
 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
                                echo $ac_n "checking for pthread_create in default libraries""... $ac_c" 1>&6
-echo "configure:11884: checking for pthread_create in default libraries" >&5
+echo "configure:11855: 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 11891 "configure"
+#line 11862 "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
@@ -11907,43 +11875,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -11954,7 +11939,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:11958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:11943: \"$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 11970 "configure"
+#line 11955 "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
@@ -11990,43 +11972,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12038,7 +12037,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12041: \"$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
@@ -12063,7 +12062,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:12067: checking for pthread link with -kthread" >&5
+echo "configure:12066: 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
@@ -12074,13 +12073,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12078 "configure"
+#line 12077 "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
@@ -12094,43 +12090,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12141,7 +12154,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12158: \"$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 12157 "configure"
+#line 12170 "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
@@ -12177,43 +12187,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12225,7 +12252,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12256: \"$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
@@ -12255,7 +12282,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:12259: checking for pthread link with -pthread" >&5
+echo "configure:12286: 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
@@ -12266,13 +12293,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12270 "configure"
+#line 12297 "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
@@ -12286,43 +12310,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12333,7 +12374,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12378: \"$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 12349 "configure"
+#line 12390 "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
@@ -12369,43 +12407,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12417,7 +12472,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12476: \"$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
@@ -12447,7 +12502,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:12451: checking for pthread link with -pthreads" >&5
+echo "configure:12506: 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
@@ -12458,13 +12513,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12462 "configure"
+#line 12517 "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
@@ -12478,43 +12530,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12525,7 +12594,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12598: \"$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 12541 "configure"
+#line 12610 "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
@@ -12561,43 +12627,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12609,7 +12692,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12696: \"$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
@@ -12639,7 +12722,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:12643: checking for pthread link with -mthreads" >&5
+echo "configure:12726: 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
@@ -12650,13 +12733,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12654 "configure"
+#line 12737 "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
@@ -12670,43 +12750,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12717,7 +12814,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:12818: \"$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 12733 "configure"
+#line 12830 "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
@@ -12753,43 +12847,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12801,7 +12912,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:12916: \"$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
@@ -12831,7 +12942,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:12835: checking for pthread link with -thread" >&5
+echo "configure:12946: 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
@@ -12842,13 +12953,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 12846 "configure"
+#line 12957 "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
@@ -12862,43 +12970,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12909,7 +13034,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:12913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13038: \"$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 12925 "configure"
+#line 13050 "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
@@ -12945,43 +13067,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -12993,7 +13132,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:12997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13136: \"$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
@@ -13024,7 +13163,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:13028: checking for pthread link with -lpthread -lmach -lexc -lc_r" >&5
+echo "configure:13167: 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
@@ -13035,13 +13174,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 13039 "configure"
+#line 13178 "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
@@ -13055,43 +13191,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13102,7 +13255,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13259: \"$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 13118 "configure"
+#line 13271 "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
@@ -13138,43 +13288,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13186,7 +13353,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13357: \"$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
@@ -13216,7 +13383,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:13220: checking for pthread link with -lpthread -lmach -lexc" >&5
+echo "configure:13387: 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
@@ -13227,13 +13394,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 13231 "configure"
+#line 13398 "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
@@ -13247,43 +13411,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13294,7 +13475,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13479: \"$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 13310 "configure"
+#line 13491 "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
@@ -13330,43 +13508,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13378,7 +13573,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13577: \"$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
@@ -13409,7 +13604,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:13413: checking for pthread link with -lpthread -Wl,-woff,85" >&5
+echo "configure:13608: 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
@@ -13420,13 +13615,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 13424 "configure"
+#line 13619 "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
@@ -13440,43 +13632,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13487,7 +13696,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13700: \"$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 13503 "configure"
+#line 13712 "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
@@ -13523,43 +13729,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
 #endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#endif
+       }
        if( status ) return status;
+#endif
+
        status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
-#endif
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13571,7 +13794,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:13798: \"$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
@@ -13602,7 +13825,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:13606: checking for pthread link with -lpthread" >&5
+echo "configure:13829: 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
@@ -13613,13 +13836,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 13617 "configure"
+#line 13840 "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
@@ -13633,43 +13853,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13680,7 +13917,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:13921: \"$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 13696 "configure"
+#line 13933 "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
@@ -13716,43 +13950,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13764,7 +14015,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14019: \"$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
@@ -13794,7 +14045,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:13798: checking for pthread link with -lc_r" >&5
+echo "configure:14049: 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
@@ -13805,13 +14056,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 13809 "configure"
+#line 14060 "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
@@ -13825,43 +14073,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13872,7 +14137,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:13876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14141: \"$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 13888 "configure"
+#line 14153 "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
@@ -13908,43 +14170,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -13956,7 +14235,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:13960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14239: \"$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
@@ -13987,7 +14266,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:13991: checking for pthread link with -threads" >&5
+echo "configure:14270: 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
@@ -13998,13 +14277,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14002 "configure"
+#line 14281 "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
@@ -14018,43 +14294,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14065,7 +14358,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:14069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14362: \"$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 14081 "configure"
+#line 14374 "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
@@ -14101,43 +14391,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14149,7 +14456,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:14153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14460: \"$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
@@ -14180,7 +14487,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:14184: checking for pthread link with -lpthreads -lmach -lexc -lc_r" >&5
+echo "configure:14491: 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
@@ -14191,13 +14498,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14195 "configure"
+#line 14502 "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
@@ -14211,43 +14515,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14258,7 +14579,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:14262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14583: \"$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 14274 "configure"
+#line 14595 "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
@@ -14294,43 +14612,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14342,7 +14677,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:14346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14681: \"$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
@@ -14372,7 +14707,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:14376: checking for pthread link with -lpthreads -lmach -lexc" >&5
+echo "configure:14711: 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
@@ -14383,13 +14718,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14387 "configure"
+#line 14722 "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
@@ -14403,43 +14735,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14450,7 +14799,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:14454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:14803: \"$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 14466 "configure"
+#line 14815 "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
@@ -14486,43 +14832,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14534,7 +14897,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:14538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:14901: \"$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
@@ -14564,7 +14927,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:14568: checking for pthread link with -lpthreads -lexc" >&5
+echo "configure:14931: 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
@@ -14575,13 +14938,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14579 "configure"
+#line 14942 "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
@@ -14595,43 +14955,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14642,7 +15019,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:14646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15023: \"$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 14658 "configure"
+#line 15035 "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
@@ -14678,43 +15052,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14726,7 +15117,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:14730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:15121: \"$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
@@ -14757,7 +15148,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:14761: checking for pthread link with -lpthreads" >&5
+echo "configure:15152: 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
@@ -14768,13 +15159,10 @@ else
 
                if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 14772 "configure"
+#line 15163 "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
@@ -14788,43 +15176,60 @@ 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 = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14835,7 +15240,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:14839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15244: \"$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 14851 "configure"
+#line 15256 "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
@@ -14871,43 +15273,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -14919,7 +15338,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:14923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:15342: \"$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"
                                                                                                for ac_func in sched_yield pthread_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:14960: checking for $ac_func" >&5
+echo "configure:15384: 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 14965 "configure"
+#line 15389 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -14985,7 +15409,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:14989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15413: \"$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
@@ -15013,7 +15437,7 @@ done
                        if test $ac_cv_func_sched_yield = no -a \
                                $ac_cv_func_pthread_yield = no ; then
                                                                echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:15017: checking for sched_yield in -lrt" >&5
+echo "configure:15441: 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
@@ -15021,7 +15445,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lrt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15025 "configure"
+#line 15449 "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
@@ -15032,7 +15456,7 @@ int main() {
 sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:15036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
                                                                                                for ac_func in thr_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15068: checking for $ac_func" >&5
+echo "configure:15492: 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 15073 "configure"
+#line 15497 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -15093,7 +15517,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15521: \"$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
@@ -15127,12 +15551,12 @@ done
                                                for ac_func in pthread_kill pthread_rwlock_destroy
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15131: checking for $ac_func" >&5
+echo "configure:15555: 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 15136 "configure"
+#line 15560 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -15156,7 +15580,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15160: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15584: \"$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
@@ -15182,13 +15606,13 @@ done
 
 
                                                                        echo $ac_n "checking for pthread_detach with <pthread.h>""... $ac_c" 1>&6
-echo "configure:15186: checking for pthread_detach with <pthread.h>" >&5
+echo "configure:15610: 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 15192 "configure"
+#line 15616 "configure"
 #include "confdefs.h"
 
 #include <pthread.h>
@@ -15200,7 +15624,7 @@ int main() {
 pthread_detach(NULL);
 ; return 0; }
 EOF
-if { (eval echo configure:15204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15628: \"$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
@@ -15232,12 +15656,12 @@ EOF
                        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:15236: checking for $ac_func" >&5
+echo "configure:15660: 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 15241 "configure"
+#line 15665 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -15261,7 +15685,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15689: \"$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
@@ -15290,12 +15714,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:15294: checking for $ac_func" >&5
+echo "configure:15718: 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 15299 "configure"
+#line 15723 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -15319,7 +15743,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:15747: \"$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
@@ -15344,7 +15768,7 @@ fi
 done
 
        echo $ac_n "checking for LinuxThreads implementation""... $ac_c" 1>&6
-echo "configure:15348: checking for LinuxThreads implementation" >&5
+echo "configure:15772: 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
@@ -15357,7 +15781,7 @@ echo "$ac_t""$ol_cv_sys_linux_threads" 1>&6
        
        
        echo $ac_n "checking for LinuxThreads consistency""... $ac_c" 1>&6
-echo "configure:15361: checking for LinuxThreads consistency" >&5
+echo "configure:15785: checking for LinuxThreads consistency" >&5
 if eval "test \"\${ol_cv_linux_threads+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -15382,7 +15806,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:15386: checking if pthread_create() works" >&5
+echo "configure:15810: 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
@@ -15391,13 +15815,10 @@ else
                                ol_cv_pthread_create_works=yes
 else
   cat > conftest.$ac_ext <<EOF
-#line 15395 "configure"
+#line 15819 "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
@@ -15415,43 +15836,60 @@ int main(argc, argv)
 {
 
        /* pthread test function */
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
        pthread_t t;
        int status;
-       int detach = PTHREAD_CREATE_DETACHED;
+       int detach = 1;
 
-#if HAVE_PTHREADS > 4
+#ifdef HAVE_PTHREADS_FINAL
        /* Final pthreads */
        pthread_attr_t attr;
 
        status = pthread_attr_init(&attr);
        if( status ) return status;
 
-#if HAVE_PTHREADS < 7
-       status = pthread_attr_setdetachstate(&attr, &detach);
-       if( status < 0 ) status = errno;
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if( !detach ) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       status = pthread_attr_setdetachstate(&attr, detach);
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 #endif
+       }
        if( status ) return status;
-       status = pthread_create( &t, &attr, task, NULL );
-#if HAVE_PTHREADS < 7
-       if( status < 0 ) status = errno;
 #endif
+
+       status = pthread_create( &t, &attr, task, NULL );
        if( status ) return status;
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
+
+               status = pthread_detach( t );
+               if( status ) return status;
+       }
+#endif
+
 #else
        /* Draft 4 pthreads */
        status = pthread_create( &t, pthread_attr_default, task, NULL );
-       if( status ) return errno;
+       if( status ) return status;
 
-       /* give thread a chance to complete */
-       /* it should remain joinable and hence detachable */
-       sleep( 1 );
+       if( detach ) {
+               /* give thread a chance to complete */
+               /* it should remain joinable and hence detachable */
+               sleep( 1 );
 
-       status = pthread_detach( &t );
-       if( status ) return errno;
+               status = pthread_detach( &t );
+               if( status ) return status;
+       }
 #endif
 
 #ifdef HAVE_LINUX_THREADS
@@ -15463,7 +15901,7 @@ int main(argc, argv)
 }
 
 EOF
-if { (eval echo configure:15467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:15905: \"$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
@@ -15485,7 +15923,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:15489: checking if select yields when using pthreads" >&5
+echo "configure:15927: 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
@@ -15494,7 +15932,7 @@ else
   ol_cv_pthread_select_yields=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 15498 "configure"
+#line 15936 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -15553,7 +15991,7 @@ int main(argc, argv)
 #endif
 #endif
 
-#if HAVE_PTHREADS < 6
+#if HAVE_PTHREADS_D4
        pthread_create(&t, pthread_attr_default, task, NULL);
 #else
        pthread_create(&t, NULL, task, NULL);
@@ -15570,7 +16008,7 @@ int main(argc, argv)
        exit(2);
 }
 EOF
-if { (eval echo configure:15574: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:16012: \"$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
@@ -15614,17 +16052,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:15618: checking for $ac_hdr" >&5
+echo "configure:16056: 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 15623 "configure"
+#line 16061 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15628: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16066: \"$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*
@@ -15654,12 +16092,12 @@ done
                ol_with_threads=found
 
                                echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
-echo "configure:15658: checking for cthread_fork" >&5
+echo "configure:16096: 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 15663 "configure"
+#line 16101 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char cthread_fork(); below.  */
@@ -15683,7 +16121,7 @@ f = cthread_fork;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16125: \"$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
@@ -15705,7 +16143,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:15709: checking for cthread_fork with -all_load" >&5
+echo "configure:16147: 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
@@ -15713,7 +16151,7 @@ else
                                                                save_LIBS="$LIBS"
                                LIBS="-all_load $LIBS"
                                cat > conftest.$ac_ext <<EOF
-#line 15717 "configure"
+#line 16155 "configure"
 #include "confdefs.h"
 #include <mach/cthreads.h>
 int main() {
@@ -15722,7 +16160,7 @@ int main() {
                                        
 ; return 0; }
 EOF
-if { (eval echo configure:15726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16164: \"$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
@@ -15752,12 +16190,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:15756: checking for cthread_fork" >&5
+echo "configure:16194: 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 15761 "configure"
+#line 16199 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char cthread_fork(); below.  */
@@ -15781,7 +16219,7 @@ f = cthread_fork;
 
 ; return 0; }
 EOF
-if { (eval echo configure:15785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16223: \"$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
@@ -15831,17 +16269,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:15835: checking for $ac_hdr" >&5
+echo "configure:16273: 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 15840 "configure"
+#line 16278 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15845: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16283: \"$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*
@@ -15870,7 +16308,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:15874: checking for pth_version in -lpth" >&5
+echo "configure:16312: 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
@@ -15878,7 +16316,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpth  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15882 "configure"
+#line 16320 "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
@@ -15889,7 +16327,7 @@ int main() {
 pth_version()
 ; return 0; }
 EOF
-if { (eval echo configure:15893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16331: \"$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
@@ -15934,17 +16372,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:15938: checking for $ac_hdr" >&5
+echo "configure:16376: 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 15943 "configure"
+#line 16381 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15948: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16386: \"$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*
@@ -15972,7 +16410,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:15976: checking for thr_create in -lthread" >&5
+echo "configure:16414: 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
@@ -15980,7 +16418,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 15984 "configure"
+#line 16422 "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
@@ -15991,7 +16429,7 @@ int main() {
 thr_create()
 ; return 0; }
 EOF
-if { (eval echo configure:15995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16433: \"$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
@@ -16031,12 +16469,12 @@ EOF
                        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:16035: checking for $ac_func" >&5
+echo "configure:16473: 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 16040 "configure"
+#line 16478 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -16060,7 +16498,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:16064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16502: \"$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
@@ -16091,17 +16529,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16095: checking for $ac_hdr" >&5
+echo "configure:16533: 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 16100 "configure"
+#line 16538 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16105: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16543: \"$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*
@@ -16129,7 +16567,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:16133: checking for lwp_create in -llwp" >&5
+echo "configure:16571: 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
@@ -16137,7 +16575,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-llwp  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 16141 "configure"
+#line 16579 "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
@@ -16148,7 +16586,7 @@ int main() {
 lwp_create()
 ; return 0; }
 EOF
-if { (eval echo configure:16152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16590: \"$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
@@ -16201,17 +16639,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:16205: checking for $ac_hdr" >&5
+echo "configure:16643: 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 16210 "configure"
+#line 16648 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16653: \"$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*
@@ -16240,12 +16678,12 @@ done
        for ac_func in sched_yield pthread_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:16244: checking for $ac_func" >&5
+echo "configure:16682: 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 16249 "configure"
+#line 16687 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -16269,7 +16707,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:16273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16711: \"$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
@@ -16295,12 +16733,12 @@ done
 
        
        echo $ac_n "checking for LinuxThreads pthread.h""... $ac_c" 1>&6
-echo "configure:16299: checking for LinuxThreads pthread.h" >&5
+echo "configure:16737: 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 16304 "configure"
+#line 16742 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 EOF
@@ -16330,17 +16768,17 @@ EOF
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16334: checking for $ac_hdr" >&5
+echo "configure:16772: 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 16339 "configure"
+#line 16777 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16344: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16782: \"$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*
@@ -16370,17 +16808,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16374: checking for $ac_hdr" >&5
+echo "configure:16812: 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 16379 "configure"
+#line 16817 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16384: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16822: \"$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*
@@ -16410,17 +16848,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16414: checking for $ac_hdr" >&5
+echo "configure:16852: 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 16419 "configure"
+#line 16857 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16424: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:16862: \"$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*
@@ -16479,20 +16917,20 @@ EOF
 
 
                        echo $ac_n "checking for thread specific errno""... $ac_c" 1>&6
-echo "configure:16483: checking for thread specific errno" >&5
+echo "configure:16921: 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 16489 "configure"
+#line 16927 "configure"
 #include "confdefs.h"
 #include <errno.h>
 int main() {
 errno = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:16496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_errno_thread_specific=yes
 else
 echo "$ac_t""$ol_cv_errno_thread_specific" 1>&6
 
                        echo $ac_n "checking for thread specific h_errno""... $ac_c" 1>&6
-echo "configure:16512: checking for thread specific h_errno" >&5
+echo "configure:16950: 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 16518 "configure"
+#line 16956 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 int main() {
 h_errno = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:16525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:16963: \"$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
@@ -16579,17 +17017,17 @@ if test $ol_with_ldbm_api = auto \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:16583: checking for $ac_hdr" >&5
+echo "configure:17021: 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 16588 "configure"
+#line 17026 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:16593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:17031: \"$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*
@@ -16617,13 +17055,13 @@ 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:16621: checking if Berkeley DB header compatibility" >&5
+echo "configure:17059: 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 16627 "configure"
+#line 17065 "configure"
 #include "confdefs.h"
 
 #if HAVE_DB_185_H
@@ -16660,7 +17098,7 @@ echo "$ac_t""$ol_cv_header_db1" 1>&6
                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:16664: checking for Berkeley DB link (default)" >&5
+echo "configure:17102: 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
@@ -16670,7 +17108,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 16674 "configure"
+#line 17112 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -16717,7 +17155,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:16721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_none=yes
 else
@@ -16741,7 +17179,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb4)""... $ac_c" 1>&6
-echo "configure:16745: checking for Berkeley DB link (-ldb4)" >&5
+echo "configure:17183: 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
@@ -16751,7 +17189,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 16755 "configure"
+#line 17193 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -16798,7 +17236,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:16802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db4=yes
 else
@@ -16822,7 +17260,7 @@ 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:16826: checking for Berkeley DB link (-ldb-4)" >&5
+echo "configure:17264: 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
@@ -16832,7 +17270,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 16836 "configure"
+#line 17274 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -16879,7 +17317,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:16883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17321: \"$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
@@ -16903,7 +17341,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb)""... $ac_c" 1>&6
-echo "configure:16907: checking for Berkeley DB link (-ldb)" >&5
+echo "configure:17345: 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
@@ -16913,7 +17351,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 16917 "configure"
+#line 17355 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -16960,7 +17398,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:16964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db=yes
 else
@@ -16984,7 +17422,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb3)""... $ac_c" 1>&6
-echo "configure:16988: checking for Berkeley DB link (-ldb3)" >&5
+echo "configure:17426: 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
@@ -16994,7 +17432,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 16998 "configure"
+#line 17436 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17041,7 +17479,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db3=yes
 else
@@ -17065,7 +17503,7 @@ 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:17069: checking for Berkeley DB link (-ldb-3)" >&5
+echo "configure:17507: 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
@@ -17075,7 +17513,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17079 "configure"
+#line 17517 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17122,7 +17560,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17564: \"$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
@@ -17146,7 +17584,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb2)""... $ac_c" 1>&6
-echo "configure:17150: checking for Berkeley DB link (-ldb2)" >&5
+echo "configure:17588: 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
@@ -17156,7 +17594,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17160 "configure"
+#line 17598 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17203,7 +17641,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db2=yes
 else
@@ -17227,7 +17665,7 @@ 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:17231: checking for Berkeley DB link (-ldb-2)" >&5
+echo "configure:17669: 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
@@ -17237,7 +17675,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17241 "configure"
+#line 17679 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17284,7 +17722,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17726: \"$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
@@ -17308,7 +17746,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb1)""... $ac_c" 1>&6
-echo "configure:17312: checking for Berkeley DB link (-ldb1)" >&5
+echo "configure:17750: 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
@@ -17318,7 +17756,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17322 "configure"
+#line 17760 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17365,7 +17803,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db1=yes
 else
@@ -17389,7 +17827,7 @@ 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:17393: checking for Berkeley DB link (-ldb-1)" >&5
+echo "configure:17831: 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
@@ -17399,7 +17837,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17403 "configure"
+#line 17841 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17446,7 +17884,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:17888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db_1=yes
 else
@@ -17481,17 +17919,17 @@ 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:17485: checking for $ac_hdr" >&5
+echo "configure:17923: 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 17490 "configure"
+#line 17928 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:17495: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:17933: \"$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*
@@ -17521,7 +17959,7 @@ 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:17525: checking for Berkeley DB link (default)" >&5
+echo "configure:17963: 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
@@ -17531,7 +17969,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17535 "configure"
+#line 17973 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17578,7 +18016,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_none=yes
 else
@@ -17602,7 +18040,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb4)""... $ac_c" 1>&6
-echo "configure:17606: checking for Berkeley DB link (-ldb4)" >&5
+echo "configure:18044: 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
@@ -17612,7 +18050,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17616 "configure"
+#line 18054 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17659,7 +18097,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db4=yes
 else
@@ -17683,7 +18121,7 @@ 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:17687: checking for Berkeley DB link (-ldb-4)" >&5
+echo "configure:18125: 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
@@ -17693,7 +18131,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17697 "configure"
+#line 18135 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17740,7 +18178,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18182: \"$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
@@ -17764,7 +18202,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb)""... $ac_c" 1>&6
-echo "configure:17768: checking for Berkeley DB link (-ldb)" >&5
+echo "configure:18206: 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
@@ -17774,7 +18212,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17778 "configure"
+#line 18216 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17821,7 +18259,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db=yes
 else
@@ -17845,7 +18283,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb3)""... $ac_c" 1>&6
-echo "configure:17849: checking for Berkeley DB link (-ldb3)" >&5
+echo "configure:18287: 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
@@ -17855,7 +18293,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17859 "configure"
+#line 18297 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17902,7 +18340,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db3=yes
 else
@@ -17926,7 +18364,7 @@ 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:17930: checking for Berkeley DB link (-ldb-3)" >&5
+echo "configure:18368: 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
@@ -17936,7 +18374,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 17940 "configure"
+#line 18378 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -17983,7 +18421,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:17987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18425: \"$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
@@ -18007,7 +18445,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb2)""... $ac_c" 1>&6
-echo "configure:18011: checking for Berkeley DB link (-ldb2)" >&5
+echo "configure:18449: 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
@@ -18017,7 +18455,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 18021 "configure"
+#line 18459 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -18064,7 +18502,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:18068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db2=yes
 else
@@ -18088,7 +18526,7 @@ 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:18092: checking for Berkeley DB link (-ldb-2)" >&5
+echo "configure:18530: 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
@@ -18098,7 +18536,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 18102 "configure"
+#line 18540 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -18145,7 +18583,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:18149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18587: \"$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
@@ -18169,7 +18607,7 @@ fi
 
 if test $ol_cv_lib_db = no ; then
        echo $ac_n "checking for Berkeley DB link (-ldb1)""... $ac_c" 1>&6
-echo "configure:18173: checking for Berkeley DB link (-ldb1)" >&5
+echo "configure:18611: 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
@@ -18179,7 +18617,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 18183 "configure"
+#line 18621 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -18226,7 +18664,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:18230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db1=yes
 else
@@ -18250,7 +18688,7 @@ 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:18254: checking for Berkeley DB link (-ldb-1)" >&5
+echo "configure:18692: 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
@@ -18260,7 +18698,7 @@ else
        LIBS="$ol_DB_LIB $LIBS"
 
        cat > conftest.$ac_ext <<EOF
-#line 18264 "configure"
+#line 18702 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -18307,7 +18745,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:18311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:18749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_db_db_1=yes
 else
@@ -18333,7 +18771,7 @@ 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:18337: checking for Berkeley DB thread support" >&5
+echo "configure:18775: 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
@@ -18347,7 +18785,7 @@ else
   ol_cv_berkeley_db_thread=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 18351 "configure"
+#line 18789 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_DB_185_H
@@ -18414,7 +18852,7 @@ main()
        return rc;
 }
 EOF
-if { (eval echo configure:18418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:18856: \"$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
@@ -18475,13 +18913,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:18479: checking Berkeley DB version for BDB backend" >&5
+echo "configure:18917: 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 18485 "configure"
+#line 18923 "configure"
 #include "confdefs.h"
 
 #include <db.h>
 
 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:18532: checking for MDBM library" >&5
+echo "configure:18970: 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:18538: checking for mdbm_set_chain" >&5
+echo "configure:18976: 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 18543 "configure"
+#line 18981 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char mdbm_set_chain(); below.  */
@@ -18563,7 +19001,7 @@ f = mdbm_set_chain;
 
 ; return 0; }
 EOF
-if { (eval echo configure:18567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19005: \"$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
@@ -18582,7 +19020,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for mdbm_set_chain in -lmdbm""... $ac_c" 1>&6
-echo "configure:18586: checking for mdbm_set_chain in -lmdbm" >&5
+echo "configure:19024: 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
@@ -18590,7 +19028,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmdbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18594 "configure"
+#line 19032 "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
@@ -18601,7 +19039,7 @@ int main() {
 mdbm_set_chain()
 ; return 0; }
 EOF
-if { (eval echo configure:18605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19043: \"$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
@@ -18636,17 +19074,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:18640: checking for $ac_hdr" >&5
+echo "configure:19078: 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 18645 "configure"
+#line 19083 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:18650: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:19088: \"$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*
@@ -18673,7 +19111,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:18677: checking for db" >&5
+echo "configure:19115: 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:18710: checking for GDBM library" >&5
+echo "configure:19148: 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:18716: checking for gdbm_open" >&5
+echo "configure:19154: 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 18721 "configure"
+#line 19159 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gdbm_open(); below.  */
@@ -18741,7 +19179,7 @@ f = gdbm_open;
 
 ; return 0; }
 EOF
-if { (eval echo configure:18745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19183: \"$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
@@ -18760,7 +19198,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:18764: checking for gdbm_open in -lgdbm" >&5
+echo "configure:19202: 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
@@ -18768,7 +19206,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgdbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18772 "configure"
+#line 19210 "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
@@ -18779,7 +19217,7 @@ int main() {
 gdbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:18783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19221: \"$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
@@ -18814,17 +19252,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:18818: checking for $ac_hdr" >&5
+echo "configure:19256: 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 18823 "configure"
+#line 19261 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:18828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:19266: \"$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*
@@ -18851,7 +19289,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:18855: checking for db" >&5
+echo "configure:19293: 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:18889: checking for NDBM library" >&5
+echo "configure:19327: 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:18895: checking for dbm_open" >&5
+echo "configure:19333: 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 18900 "configure"
+#line 19338 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbm_open(); below.  */
@@ -18920,7 +19358,7 @@ f = dbm_open;
 
 ; return 0; }
 EOF
-if { (eval echo configure:18924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19362: \"$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
@@ -18939,7 +19377,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6
-echo "configure:18943: checking for dbm_open in -lndbm" >&5
+echo "configure:19381: 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
@@ -18947,7 +19385,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lndbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18951 "configure"
+#line 19389 "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
@@ -18958,7 +19396,7 @@ int main() {
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:18962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19400: \"$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
@@ -18978,7 +19416,7 @@ else
   echo "$ac_t""no" 1>&6
 
                        echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:18982: checking for dbm_open in -ldbm" >&5
+echo "configure:19420: 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
@@ -18986,7 +19424,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 18990 "configure"
+#line 19428 "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
@@ -18997,7 +19435,7 @@ int main() {
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:19001: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19439: \"$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
@@ -19034,17 +19472,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:19038: checking for $ac_hdr" >&5
+echo "configure:19476: 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 19043 "configure"
+#line 19481 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19048: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:19486: \"$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*
@@ -19071,7 +19509,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:19075: checking for db" >&5
+echo "configure:19513: checking for db" >&5
 if eval "test \"\${ol_cv_ndbm+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -19128,17 +19566,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:19132: checking for $ac_hdr" >&5
+echo "configure:19570: 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 19137 "configure"
+#line 19575 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19142: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:19580: \"$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*
@@ -19160,11 +19598,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:19164: checking for TCP wrappers library" >&5
+echo "configure:19602: checking for TCP wrappers library" >&5
                save_LIBS="$LIBS"
                LIBS="$LIBS -lwrap"
                cat > conftest.$ac_ext <<EOF
-#line 19168 "configure"
+#line 19606 "configure"
 #include "confdefs.h"
 
 #include <tcpd.h>
@@ -19179,7 +19617,7 @@ hosts_access(req)
                
 ; return 0; }
 EOF
-if { (eval echo configure:19183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19621: \"$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
@@ -19191,7 +19629,7 @@ else
   
                                LIBS="$LIBS -lnsl"
                cat > conftest.$ac_ext <<EOF
-#line 19195 "configure"
+#line 19633 "configure"
 #include "confdefs.h"
 
 #include <tcpd.h>
@@ -19206,7 +19644,7 @@ hosts_access(req)
                
 ; return 0; }
 EOF
-if { (eval echo configure:19210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19648: \"$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:19250: checking for openlog" >&5
+echo "configure:19688: 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 19255 "configure"
+#line 19693 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char openlog(); below.  */
@@ -19275,7 +19713,7 @@ f = openlog;
 
 ; return 0; }
 EOF
-if { (eval echo configure:19279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19717: \"$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
@@ -19304,7 +19742,7 @@ fi
 ol_link_sql=no
 if test $ol_enable_sql != no ; then
        echo $ac_n "checking for SQLDriverConnect in -liodbc""... $ac_c" 1>&6
-echo "configure:19308: checking for SQLDriverConnect in -liodbc" >&5
+echo "configure:19746: 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
@@ -19312,7 +19750,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-liodbc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19316 "configure"
+#line 19754 "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
@@ -19323,7 +19761,7 @@ int main() {
 SQLDriverConnect()
 ; return 0; }
 EOF
-if { (eval echo configure:19327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19765: \"$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
@@ -19348,7 +19786,7 @@ fi
                ol_link_sql="-liodbc"
        else
                echo $ac_n "checking for SQLDriverConnect in -lodbc""... $ac_c" 1>&6
-echo "configure:19352: checking for SQLDriverConnect in -lodbc" >&5
+echo "configure:19790: 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
@@ -19356,7 +19794,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lodbc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19360 "configure"
+#line 19798 "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
@@ -19367,7 +19805,7 @@ int main() {
 SQLDriverConnect()
 ; return 0; }
 EOF
-if { (eval echo configure:19371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19809: \"$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
@@ -19406,17 +19844,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:19410: checking for $ac_hdr" >&5
+echo "configure:19848: 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 19415 "configure"
+#line 19853 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19420: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:19858: \"$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*
@@ -19445,7 +19883,7 @@ done
 
 if test $ol_link_termcap = no ; then
        echo $ac_n "checking for tputs in -ltermcap""... $ac_c" 1>&6
-echo "configure:19449: checking for tputs in -ltermcap" >&5
+echo "configure:19887: 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
@@ -19453,7 +19891,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19457 "configure"
+#line 19895 "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
@@ -19464,7 +19902,7 @@ int main() {
 tputs()
 ; return 0; }
 EOF
-if { (eval echo configure:19468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19906: \"$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
@@ -19497,7 +19935,7 @@ fi
 
 if test $ol_link_termcap = no ; then
        echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:19501: checking for initscr in -lncurses" >&5
+echo "configure:19939: 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
@@ -19505,7 +19943,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19509 "configure"
+#line 19947 "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
@@ -19516,7 +19954,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:19520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:19958: \"$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
@@ -19562,17 +20000,17 @@ if test $ol_with_cyrus_sasl != no ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:19566: checking for $ac_hdr" >&5
+echo "configure:20004: 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 19571 "configure"
+#line 20009 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19576: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:20014: \"$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*
@@ -19601,7 +20039,7 @@ done
 
        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:19605: checking for sasl_client_init in -lsasl2" >&5
+echo "configure:20043: 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
@@ -19609,7 +20047,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsasl2  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19613 "configure"
+#line 20051 "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
@@ -19620,7 +20058,7 @@ int main() {
 sasl_client_init()
 ; return 0; }
 EOF
-if { (eval echo configure:19624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20062: \"$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
@@ -19639,7 +20077,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 sasl_client_init in -lsasl""... $ac_c" 1>&6
-echo "configure:19643: checking for sasl_client_init in -lsasl" >&5
+echo "configure:20081: 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
@@ -19647,7 +20085,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsasl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19651 "configure"
+#line 20089 "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
@@ -19658,7 +20096,7 @@ int main() {
 sasl_client_init()
 ; return 0; }
 EOF
-if { (eval echo configure:19662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20100: \"$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
        else
                echo $ac_n "checking Cyrus SASL library version""... $ac_c" 1>&6
-echo "configure:19698: checking Cyrus SASL library version" >&5
+echo "configure:20136: 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 19704 "configure"
+#line 20142 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SASL_SASL_H
@@ -19751,12 +20189,12 @@ EOF
                ac_save_LIBS="$LIBS"
                LIBS="$LIBS $ol_link_sasl"
                echo $ac_n "checking for sasl_version""... $ac_c" 1>&6
-echo "configure:19755: checking for sasl_version" >&5
+echo "configure:20193: 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 19760 "configure"
+#line 20198 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char sasl_version(); below.  */
@@ -19780,7 +20218,7 @@ f = sasl_version;
 
 ; return 0; }
 EOF
-if { (eval echo configure:19784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_sasl_version=yes"
 else
@@ -19839,13 +20277,13 @@ 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:19843: checking fetch(3) library" >&5
+echo "configure:20281: checking fetch(3) library" >&5
 if eval "test \"\${ol_cv_lib_fetch+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 19849 "configure"
+#line 20287 "configure"
 #include "confdefs.h"
 
 #include <sys/param.h>
@@ -19855,7 +20293,7 @@ int main() {
 struct url *u = fetchParseURL("file:///"); 
 ; return 0; }
 EOF
-if { (eval echo configure:19859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ol_cv_lib_fetch=yes
 else
@@ -19893,17 +20331,17 @@ if test $ol_with_readline != no ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:19897: checking for $ac_hdr" >&5
+echo "configure:20335: 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 19902 "configure"
+#line 20340 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:19907: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:20345: \"$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*
@@ -19934,7 +20372,7 @@ done
                save_LIBS="$LIBS"
                LIBS="$TERMCAP_LIBS $LIBS"
                echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6
-echo "configure:19938: checking for readline in -lreadline" >&5
+echo "configure:20376: checking for readline in -lreadline" >&5
 ac_lib_var=`echo readline'_'readline | sed 'y%./+-:%__p__%'`
 if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -19942,7 +20380,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lreadline  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 19946 "configure"
+#line 20384 "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
@@ -19953,7 +20391,7 @@ int main() {
 readline()
 ; return 0; }
 EOF
-if { (eval echo configure:19957: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20395: \"$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
 
 if test $ol_enable_crypt != no ; then
        echo $ac_n "checking for crypt""... $ac_c" 1>&6
-echo "configure:19999: checking for crypt" >&5
+echo "configure:20437: 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 20004 "configure"
+#line 20442 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char crypt(); below.  */
@@ -20024,7 +20462,7 @@ f = crypt;
 
 ; return 0; }
 EOF
-if { (eval echo configure:20028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20466: \"$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
@@ -20043,7 +20481,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:20047: checking for crypt in -lcrypt" >&5
+echo "configure:20485: 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
@@ -20051,7 +20489,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 20055 "configure"
+#line 20493 "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
@@ -20062,7 +20500,7 @@ int main() {
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:20066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20504: \"$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
 
 if test $ol_enable_proctitle != no ; then
        echo $ac_n "checking for setproctitle""... $ac_c" 1>&6
-echo "configure:20109: checking for setproctitle" >&5
+echo "configure:20547: 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 20114 "configure"
+#line 20552 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char setproctitle(); below.  */
@@ -20134,7 +20572,7 @@ f = setproctitle;
 
 ; return 0; }
 EOF
-if { (eval echo configure:20138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20576: \"$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
@@ -20153,7 +20591,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for setproctitle in -lutil""... $ac_c" 1>&6
-echo "configure:20157: checking for setproctitle in -lutil" >&5
+echo "configure:20595: 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
@@ -20161,7 +20599,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lutil  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 20165 "configure"
+#line 20603 "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
@@ -20172,7 +20610,7 @@ int main() {
 setproctitle()
 ; return 0; }
 EOF
-if { (eval echo configure:20176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20614: \"$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
@@ -20212,17 +20650,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:20216: checking for $ac_hdr" >&5
+echo "configure:20654: 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 20221 "configure"
+#line 20659 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:20226: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:20664: \"$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*
@@ -20251,7 +20689,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:20255: checking for SLPOpen in -lslp" >&5
+echo "configure:20693: 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
@@ -20259,7 +20697,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lslp  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 20263 "configure"
+#line 20701 "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
@@ -20270,7 +20708,7 @@ int main() {
 SLPOpen()
 ; return 0; }
 EOF
-if { (eval echo configure:20274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:20712: \"$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
@@ -20305,12 +20743,12 @@ EOF
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:20309: checking for ANSI C header files" >&5
+echo "configure:20747: 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 20314 "configure"
+#line 20752 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -20318,7 +20756,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:20322: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:20760: \"$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*
@@ -20335,7 +20773,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 20339 "configure"
+#line 20777 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -20353,7 +20791,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 20357 "configure"
+#line 20795 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -20374,7 +20812,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 20378 "configure"
+#line 20816 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #if ((' ' & 0x0FF) == 0x020)
@@ -20392,7 +20830,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:20396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:20834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -20416,12 +20854,12 @@ EOF
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:20420: checking for mode_t" >&5
+echo "configure:20858: 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 20425 "configure"
+#line 20863 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -20452,12 +20890,12 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:20456: checking for off_t" >&5
+echo "configure:20894: 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 20461 "configure"
+#line 20899 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -20488,12 +20926,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:20492: checking for pid_t" >&5
+echo "configure:20930: 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 20497 "configure"
+#line 20935 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -20524,19 +20962,19 @@ EOF
 fi
 
 echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6
-echo "configure:20528: checking for ptrdiff_t" >&5
+echo "configure:20966: 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 20533 "configure"
+#line 20971 "configure"
 #include "confdefs.h"
 #include <stddef.h>
 int main() {
 ptrdiff_t p
 ; return 0; }
 EOF
-if { (eval echo configure:20540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:20978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   am_cv_type_ptrdiff_t=yes
 else
@@ -20557,12 +20995,12 @@ EOF
    fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:20561: checking return type of signal handlers" >&5
+echo "configure:20999: 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 20566 "configure"
+#line 21004 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -20579,7 +21017,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:20583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21021: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -20598,12 +21036,12 @@ EOF
 
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:20602: checking for size_t" >&5
+echo "configure:21040: 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 20607 "configure"
+#line 21045 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 
 
 echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:20639: checking for ssize_t" >&5
+echo "configure:21077: 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 20644 "configure"
+#line 21082 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -20671,12 +21109,12 @@ EOF
 fi
 
 echo $ac_n "checking for caddr_t""... $ac_c" 1>&6
-echo "configure:20675: checking for caddr_t" >&5
+echo "configure:21113: 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 20680 "configure"
+#line 21118 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
 
 
 echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
-echo "configure:20712: checking for socklen_t" >&5
+echo "configure:21150: 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 20717 "configure"
+#line 21155 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_TYPES_H
@@ -20727,7 +21165,7 @@ int main() {
 socklen_t len;
 ; return 0; }
 EOF
-if { (eval echo configure:20731: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21169: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_type_socklen_t=yes
 else
@@ -20748,12 +21186,12 @@ EOF
   fi
  
 echo $ac_n "checking for member st_blksize in aggregate type struct stat""... $ac_c" 1>&6
-echo "configure:20752: checking for member st_blksize in aggregate type struct stat" >&5
+echo "configure:21190: 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 20757 "configure"
+#line 21195 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -20761,7 +21199,7 @@ int main() {
 struct stat foo; foo.st_blksize;
 ; return 0; }
 EOF
-if { (eval echo configure:20765: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_struct_member_st_blksize=yes
 else
@@ -20783,12 +21221,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:20787: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:21225: 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 20792 "configure"
+#line 21230 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -20797,7 +21235,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:20801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -20818,12 +21256,12 @@ EOF
 fi
 
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:20822: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:21260: 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 20827 "configure"
+#line 21265 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -20831,7 +21269,7 @@ int main() {
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:20835: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -20852,12 +21290,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:20856: checking for uid_t in sys/types.h" >&5
+echo "configure:21294: 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 20861 "configure"
+#line 21299 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -20886,19 +21324,19 @@ EOF
 fi
 
 echo $ac_n "checking for sig_atomic_t""... $ac_c" 1>&6
-echo "configure:20890: checking for sig_atomic_t" >&5
+echo "configure:21328: 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 20895 "configure"
+#line 21333 "configure"
 #include "confdefs.h"
 #include <signal.h>
 int main() {
 sig_atomic_t atomic;
 ; return 0; }
 EOF
-if { (eval echo configure:20902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21340: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_type_sig_atomic_t=yes
 else
@@ -20922,13 +21360,13 @@ EOF
 
 # test for pw_gecos in struct passwd
 echo $ac_n "checking struct passwd for pw_gecos""... $ac_c" 1>&6
-echo "configure:20926: checking struct passwd for pw_gecos" >&5
+echo "configure:21364: 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 20932 "configure"
+#line 21370 "configure"
 #include "confdefs.h"
 #include <pwd.h>
 int main() {
@@ -20938,7 +21376,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:20942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21380: \"$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:20964: checking struct passwd for pw_passwd" >&5
+echo "configure:21402: 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 20970 "configure"
+#line 21408 "configure"
 #include "confdefs.h"
 #include <pwd.h>
 int main() {
@@ -20976,7 +21414,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:20980: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21418: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_struct_passwd_pw_passwd=yes
 else
@@ -20998,7 +21436,7 @@ fi
 
 
 echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6
-echo "configure:21002: checking if toupper() requires islower()" >&5
+echo "configure:21440: 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
@@ -21007,7 +21445,7 @@ else
   ol_cv_c_upper_lower=safe
 else
   cat > conftest.$ac_ext <<EOF
-#line 21011 "configure"
+#line 21449 "configure"
 #include "confdefs.h"
 
 #include <ctype.h>
@@ -21019,7 +21457,7 @@ main()
                exit(1);
 }
 EOF
-if { (eval echo configure:21023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:21461: \"$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
@@ -21042,12 +21480,12 @@ EOF
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:21046: checking for working const" >&5
+echo "configure:21484: 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 21051 "configure"
+#line 21489 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -21096,7 +21534,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21538: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -21117,12 +21555,12 @@ EOF
 fi
 
 echo $ac_n "checking if compiler understands volatile""... $ac_c" 1>&6
-echo "configure:21121: checking if compiler understands volatile" >&5
+echo "configure:21559: 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 21126 "configure"
+#line 21564 "configure"
 #include "confdefs.h"
 int x, y, z;
 int main() {
@@ -21131,7 +21569,7 @@ volatile int a; int * volatile b = x ? &y : &z;
       *b = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:21135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_c_volatile=yes
 else
@@ -21161,14 +21599,14 @@ EOF
 
 else
        echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:21165: checking whether byte ordering is bigendian" >&5
+echo "configure:21603: 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 21172 "configure"
+#line 21610 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -21179,11 +21617,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:21183: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21621: \"$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 21187 "configure"
+#line 21625 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -21194,7 +21632,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:21198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -21214,7 +21652,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 21218 "configure"
+#line 21656 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -21227,7 +21665,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:21231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:21669: \"$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:21257: checking size of short" >&5 
+echo "configure:21695: 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 21263 "configure"
+#line 21701 "configure"
 #include "confdefs.h"
 #include "confdefs.h" 
 #include <sys/types.h> 
@@ -21269,7 +21707,7 @@ int main() {
 switch (0) case 0: case (sizeof (short) == $ac_size):;
 ; return 0; }
 EOF
-if { (eval echo configure:21273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21711: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sizeof_short=$ac_size
 else
@@ -21292,13 +21730,13 @@ EOF
  
  
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:21296: checking size of int" >&5 
+echo "configure:21734: 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 21302 "configure"
+#line 21740 "configure"
 #include "confdefs.h"
 #include "confdefs.h" 
 #include <sys/types.h> 
@@ -21308,7 +21746,7 @@ int main() {
 switch (0) case 0: case (sizeof (int) == $ac_size):;
 ; return 0; }
 EOF
-if { (eval echo configure:21312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sizeof_int=$ac_size
 else
@@ -21331,13 +21769,13 @@ EOF
  
  
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:21335: checking size of long" >&5 
+echo "configure:21773: 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 21341 "configure"
+#line 21779 "configure"
 #include "confdefs.h"
 #include "confdefs.h" 
 #include <sys/types.h> 
@@ -21347,7 +21785,7 @@ int main() {
 switch (0) case 0: case (sizeof (long) == $ac_size):;
 ; return 0; }
 EOF
-if { (eval echo configure:21351: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:21789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sizeof_long=$ac_size
 else
@@ -21398,7 +21836,7 @@ EOF
 
 
 echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:21402: checking for 8-bit clean memcmp" >&5
+echo "configure:21840: 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
@@ -21406,7 +21844,7 @@ else
   ac_cv_func_memcmp_clean=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 21410 "configure"
+#line 21848 "configure"
 #include "confdefs.h"
 
 main()
@@ -21416,7 +21854,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:21420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:21858: \"$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
@@ -21434,12 +21872,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:21438: checking for strftime" >&5
+echo "configure:21876: 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 21443 "configure"
+#line 21881 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strftime(); below.  */
@@ -21463,7 +21901,7 @@ f = strftime;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21905: \"$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
@@ -21485,7 +21923,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:21489: checking for strftime in -lintl" >&5
+echo "configure:21927: 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
@@ -21493,7 +21931,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 21497 "configure"
+#line 21935 "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
@@ -21504,7 +21942,7 @@ int main() {
 strftime()
 ; return 0; }
 EOF
-if { (eval echo configure:21508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:21946: \"$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:21536: checking for inet_aton()" >&5
+echo "configure:21974: 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 21541 "configure"
+#line 21979 "configure"
 #include "confdefs.h"
 
 #ifdef HAVE_SYS_TYPES_H
@@ -21559,7 +21997,7 @@ struct in_addr in;
 int rc = inet_aton( "255.255.255.255", &in );
 ; return 0; }
 EOF
-if { (eval echo configure:21563: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22001: \"$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
@@ -21581,12 +22019,12 @@ EOF
  
 
 echo $ac_n "checking for _spawnlp""... $ac_c" 1>&6
-echo "configure:21585: checking for _spawnlp" >&5
+echo "configure:22023: 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 21590 "configure"
+#line 22028 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _spawnlp(); below.  */
@@ -21610,7 +22048,7 @@ f = _spawnlp;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22052: \"$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:21638: checking for _snprintf" >&5
+echo "configure:22076: 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 21643 "configure"
+#line 22081 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _snprintf(); below.  */
@@ -21663,7 +22101,7 @@ f = _snprintf;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22105: \"$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:21693: checking for _vsnprintf" >&5
+echo "configure:22131: 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 21698 "configure"
+#line 22136 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _vsnprintf(); below.  */
@@ -21718,7 +22156,7 @@ f = _vsnprintf;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22160: \"$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:21748: checking for vprintf" >&5
+echo "configure:22186: 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 21753 "configure"
+#line 22191 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -21773,7 +22211,7 @@ f = vprintf;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22215: \"$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:21801: checking for _doprnt" >&5
+echo "configure:22239: 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 21806 "configure"
+#line 22244 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -21826,7 +22264,7 @@ f = _doprnt;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22268: \"$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
@@ -21855,12 +22293,12 @@ if test $ac_cv_func_vprintf = yes ; then
                for ac_func in snprintf vsnprintf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:21859: checking for $ac_func" >&5
+echo "configure:22297: 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 21864 "configure"
+#line 22302 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -21884,7 +22322,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:21888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22326: \"$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
@@ -21967,12 +22405,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:21971: checking for $ac_func" >&5
+echo "configure:22409: 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 21976 "configure"
+#line 22414 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -21996,7 +22434,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:22000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22438: \"$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
@@ -22024,12 +22462,12 @@ done
 for ac_func in getopt
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:22028: checking for $ac_func" >&5
+echo "configure:22466: 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 22033 "configure"
+#line 22471 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -22053,7 +22491,7 @@ f = $ac_func;
 
 ; return 0; }
 EOF
-if { (eval echo configure:22057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22495: \"$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
 
 # Check Configuration
 echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:22104: checking declaration of sys_errlist" >&5
+echo "configure:22542: 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 22110 "configure"
+#line 22548 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -22119,7 +22557,7 @@ int main() {
 char *c = (char *) *sys_errlist
 ; return 0; }
 EOF
-if { (eval echo configure:22123: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:22561: \"$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
@@ -22142,20 +22580,20 @@ EOF
 
 
        echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:22146: checking existence of sys_errlist" >&5
+echo "configure:22584: 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 22152 "configure"
+#line 22590 "configure"
 #include "confdefs.h"
 #include <errno.h>
 int main() {
 char *c = (char *) *sys_errlist
 ; return 0; }
 EOF
-if { (eval echo configure:22159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:22597: \"$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
index 735dd66e96e1040874385ef0da615d406b5406b6..e780b00902307044b4c44f7fb5e176cdcde83726 100644 (file)
@@ -1361,9 +1361,12 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
        if test $ac_cv_header_pthread_h = yes ; then
                OL_POSIX_THREAD_VERSION
 
-               if test $ol_cv_pthread_version != 0 ; then
-                       AC_DEFINE_UNQUOTED(HAVE_PTHREADS,$ol_cv_pthread_version,
-                               [define to pthreads API spec revision])
+               if test $ol_cv_pthread_version = final ; then
+                       AC_DEFINE(HAVE_PTHREADS_FINAL,1,
+                               [define if pthreads API compatible with final spec])
+               elif test $ol_cv_pthread_version = draft4 ; then
+                       AC_DEFINE(HAVE_PTHREADS_D4,1,
+                               [define if pthreads API compatible with draft4 spec])
                else
                        AC_MSG_ERROR([unknown pthread version])
                fi
@@ -1458,6 +1461,9 @@ dnl                       [ol_cv_pthread_lpthread_lexc])
                OL_PTHREAD_TRY([-lpthreads],[ol_cv_pthread_lib_lpthreads])
 
                if test $ol_link_threads != no ; then
+                       AC_DEFINE(HAVE_PTHREADS,1,
+                               [define if you have POSIX Threads])
+
                        LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads"
 
                        dnl save flags
@@ -1606,7 +1612,7 @@ int main(argc, argv)
 #endif
 #endif
 
-#if HAVE_PTHREADS < 6
+#if HAVE_PTHREADS_D4
        pthread_create(&t, pthread_attr_default, task, NULL);
 #else
        pthread_create(&t, NULL, task, NULL);
index f0ccb4da61d1c5903c7be51921a8b9a895fde4bb..7d31df9aead85a40abb0b6f73213f2902af684b5 100644 (file)
 /* if you have NT Event Log */
 #undef HAVE_NT_EVENT_LOG
 
-/* define to pthreads API spec revision */
-#undef HAVE_PTHREADS
+/* define if pthreads API compatible with final spec */
+#undef HAVE_PTHREADS_FINAL
+
+/* define if pthreads API compatible with draft4 spec */
+#undef HAVE_PTHREADS_D4
 
 /* if you have LinuxThreads */
 #undef HAVE_LINUX_THREADS
 
+/* define if you have POSIX Threads */
+#undef HAVE_PTHREADS
+
 /* Define if you have the sched_yield function. */
 #undef HAVE_SCHED_YIELD
 
index a328c1f33e3b618347290da20c57ce1e93908827..fef18fe9cafc76bcf7c370a6df77d4b657568f7f 100644 (file)
@@ -21,7 +21,7 @@
 #include "ldap_pvt_thread.h"
 
 
-#if HAVE_PTHREADS < 6
+#if HAVE_PTHREADS_D4
 #  define LDAP_INT_THREAD_ATTR_DEFAULT         pthread_attr_default
 #  define LDAP_INT_THREAD_CONDATTR_DEFAULT     pthread_condattr_default
 #  define LDAP_INT_THREAD_MUTEXATTR_DEFAULT    pthread_mutexattr_default
@@ -76,22 +76,6 @@ ldap_pvt_thread_get_concurrency(void)
 }
 #endif
 
-/* detachstate appeared in Draft 6, but without manifest constants.
- * in Draft 7 they were called PTHREAD_CREATE_UNDETACHED and ...DETACHED.
- * in Draft 8 on, ...UNDETACHED became ...JOINABLE.
- */
-#ifndef PTHREAD_CREATE_JOINABLE
-#ifdef PTHREAD_CREATE_UNDETACHED
-#define        PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED
-#else
-#define        PTHREAD_CREATE_JOINABLE 0
-#endif
-#endif
-
-#ifndef PTHREAD_CREATE_DETACHED
-#define        PTHREAD_CREATE_DETACHED 1
-#endif
-
 int 
 ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
        int detach,
@@ -99,13 +83,26 @@ ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
        void *arg)
 {
        int rtn;
+#if defined( HAVE_PTHREADS_FINAL )
        pthread_attr_t attr;
-
-/* Always create the thread attrs, so we can set stacksize if we need to */
-#if HAVE_PTHREADS > 5
        pthread_attr_init(&attr);
+
+#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED )
+       if (!detach) {
+#if defined( PTHREAD_CREATE_JOINABLE )
+               pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 #else
-       pthread_attr_create(&attr);
+               pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED);
+#endif
+#ifdef PTHREAD_CREATE_DETACHED
+       } else {
+               pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+#elif HAVE_PTHREADS_OS390
+       } else {
+               int st = __DETACHED;
+               pthread_attr_setdetachstate(&attr, &st);
+#endif
+       }
 #endif
 
 #if defined(LDAP_PVT_THREAD_STACK_SIZE) && LDAP_PVT_THREAD_STACK_SIZE > 0
@@ -113,27 +110,31 @@ ldap_pvt_thread_create( ldap_pvt_thread_t * thread,
        pthread_attr_setstacksize( &attr, LDAP_PVT_THREAD_STACK_SIZE );
 #endif
 
-#if HAVE_PTHREADS > 5
-       detach = detach ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE;
-#if HAVE_PTHREADS == 6
-       pthread_attr_setdetachstate(&attr, &detach);
+       rtn = pthread_create( thread, &attr, start_routine, arg );
+#ifdef HAVE_PTHREADS_OS390
+       if ( rtn == -1 ) rtn = errno;
+#endif
+
+#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED )
+       if( detach ) {
+#ifdef HAVE_PTHREADS_OS390
+               (void) pthread_detach( thread );
 #else
-       pthread_attr_setdetachstate(&attr, detach);
+               (void) pthread_detach( *thread );
 #endif
+       }
 #endif
-       rtn = pthread_create( thread, &attr, start_routine, arg );
-#if HAVE_PTHREADS > 5
        pthread_attr_destroy(&attr);
+
 #else
-       pthread_attr_delete(&attr);
+       rtn = pthread_create( thread, LDAP_INT_THREAD_ATTR_DEFAULT,
+               start_routine, arg );
+
        if( detach ) {
                pthread_detach( thread );
        }
 #endif
 
-#if HAVE_PTHREADS < 7
-       if ( rtn < 0 ) rtn = errno;
-#endif
        return rtn;
 }
 
@@ -146,14 +147,15 @@ ldap_pvt_thread_exit( void *retval )
 int 
 ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
 {
-#if HAVE_PTHREADS < 7
+#if !defined( HAVE_PTHREADS_FINAL )
        void *dummy;
-
        if (thread_return==NULL)
          thread_return=&dummy;
-
-       if ( pthread_join( thread, thread_return ) < 0 ) return errno;
-       return 0;
+#endif 
+#ifdef HAVE_PTHREADS_OS390
+       int st = pthread_join( thread, thread_return ); 
+       if ( st == -1 ) st = errno;
+       return st;
 #else
        return pthread_join( thread, thread_return );
 #endif
@@ -162,11 +164,14 @@ ldap_pvt_thread_join( ldap_pvt_thread_t thread, void **thread_return )
 int 
 ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
 {
-#if HAVE_PTHREADS > 6
+#ifdef HAVE_PTHREAD_KILL
+#ifdef HAVE_PTHREADS_OS390
+       int st = pthread_kill( thread, signo );
+       if ( st == -1 ) st = errno;
+       return st;
+#else
        return pthread_kill( thread, signo );
-#elif HAVE_PTHREADS > 4
-       if ( pthread_kill( thread, signo ) < 0 ) return errno;
-       return 0;
+#endif
 #else
        /* pthread package with DCE */
        if (kill( getpid(), signo )<0)
@@ -178,136 +183,88 @@ ldap_pvt_thread_kill( ldap_pvt_thread_t thread, int signo )
 int 
 ldap_pvt_thread_yield( void )
 {
-#if HAVE_PTHREADS == 10
+#ifdef _POSIX_THREAD_IS_GNU_PTH
+       sched_yield();
+       return 0;
+
+#elif HAVE_SCHED_YIELD
        return sched_yield();
 
-#elif defined(_POSIX_THREAD_IS_GNU_PTH)
-       sched_yield();
+#elif HAVE_PTHREAD_YIELD
+#if HAVE_PTHREADS_OS390
+       pthread_yield(NULL);
+#else
+       pthread_yield();
+#endif
        return 0;
 
 #elif HAVE_THR_YIELD
        return thr_yield();
 
-#elif HAVE_PTHREADS == 6
-       pthread_yield(NULL);
-       return 0;
 #else
-       pthread_yield();
        return 0;
-#endif
+#endif   
 }
 
 int 
 ldap_pvt_thread_cond_init( ldap_pvt_thread_cond_t *cond )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_cond_init( cond, LDAP_INT_THREAD_CONDATTR_DEFAULT ) < 0 )
-               return errno;
-       return 0;
-#else
        return pthread_cond_init( cond, LDAP_INT_THREAD_CONDATTR_DEFAULT );
-#endif
 }
 
 int 
 ldap_pvt_thread_cond_destroy( ldap_pvt_thread_cond_t *cond )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_cond_destroy( cond ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_cond_destroy( cond );
-#endif
 }
        
 int 
 ldap_pvt_thread_cond_signal( ldap_pvt_thread_cond_t *cond )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_cond_signal( cond ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_cond_signal( cond );
-#endif
 }
 
 int
 ldap_pvt_thread_cond_broadcast( ldap_pvt_thread_cond_t *cond )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_cond_broadcast( cond ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_cond_broadcast( cond );
-#endif
 }
 
 int 
 ldap_pvt_thread_cond_wait( ldap_pvt_thread_cond_t *cond, 
                      ldap_pvt_thread_mutex_t *mutex )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_cond_wait( cond, mutex ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_cond_wait( cond, mutex );
-#endif
 }
 
 int 
 ldap_pvt_thread_mutex_init( ldap_pvt_thread_mutex_t *mutex )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_mutex_init( mutex, LDAP_INT_THREAD_MUTEXATTR_DEFAULT )<0)
-               return errno;
-       return 0;
-#else
        return pthread_mutex_init( mutex, LDAP_INT_THREAD_MUTEXATTR_DEFAULT );
-#endif
 }
 
 int 
 ldap_pvt_thread_mutex_destroy( ldap_pvt_thread_mutex_t *mutex )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_mutex_destroy( mutex ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_mutex_destroy( mutex );
-#endif
 }
 
 int 
 ldap_pvt_thread_mutex_lock( ldap_pvt_thread_mutex_t *mutex )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_mutex_lock( mutex ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_mutex_lock( mutex );
-#endif
 }
 
 int 
 ldap_pvt_thread_mutex_trylock( ldap_pvt_thread_mutex_t *mutex )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_mutex_trylock( mutex ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_mutex_trylock( mutex );
-#endif
 }
 
 int 
 ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_mutex_unlock( mutex ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_mutex_unlock( mutex );
-#endif
 }
 
 #ifdef LDAP_THREAD_HAVE_RDWR
@@ -315,83 +272,43 @@ ldap_pvt_thread_mutex_unlock( ldap_pvt_thread_mutex_t *mutex )
 int 
 ldap_pvt_thread_rdwr_init( ldap_pvt_thread_rdwr_t *rw )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_rwlock_init( rw, NULL ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_rwlock_init( rw, NULL );
-#endif
 }
 
 int 
 ldap_pvt_thread_rdwr_destroy( ldap_pvt_thread_rdwr_t *rw )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_rwlock_destroy( rw ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_rwlock_destroy( rw );
-#endif
 }
 
 int ldap_pvt_thread_rdwr_rlock( ldap_pvt_thread_rdwr_t *rw )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_rwlock_rdlock( rw ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_rwlock_rdlock( rw );
-#endif
 }
 
 int ldap_pvt_thread_rdwr_rtrylock( ldap_pvt_thread_rdwr_t *rw )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_rwlock_tryrdlock( rw ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_rwlock_tryrdlock( rw );
-#endif
 }
 
 int ldap_pvt_thread_rdwr_runlock( ldap_pvt_thread_rdwr_t *rw )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_rwlock_unlock( rw ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_rwlock_unlock( rw );
-#endif
 }
 
 int ldap_pvt_thread_rdwr_wlock( ldap_pvt_thread_rdwr_t *rw )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_rwlock_wrlock( rw ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_rwlock_wrlock( rw );
-#endif
 }
 
 int ldap_pvt_thread_rdwr_wtrylock( ldap_pvt_thread_rdwr_t *rw )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_rwlock_trywrlock( rw ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_rwlock_trywrlock( rw );
-#endif
 }
 
 int ldap_pvt_thread_rdwr_wunlock( ldap_pvt_thread_rdwr_t *rw )
 {
-#if HAVE_PTHREADS < 7
-       if ( pthread_rwlock_unlock( rw ) < 0 ) return errno;
-       return 0;
-#else
        return pthread_rwlock_unlock( rw );
-#endif
 }
 
 #endif /* HAVE_PTHREAD_RDLOCK_DESTROY */