]> git.sur5r.net Git - openldap/blobdiff - build/openldap.m4
minor cleanup
[openldap] / build / openldap.m4
index 1135be94855f8fb49abce04e32d4e8d7f9e2d225..eba963945b8bd38a8fa053af3eb1d74bddaa9f71 100644 (file)
@@ -13,7 +13,7 @@ dnl $2 = help-string
 dnl $3 = default value (auto)
 dnl $4 = allowed values (auto yes no)
 AC_DEFUN([OL_ARG_ENABLE], [# OpenLDAP --enable-$1
-       AC_ARG_ENABLE($1,[$2 (]ifelse($3,,auto,$3)[)],[
+       AC_ARG_ENABLE($1,changequote(<,>)<$2 [>ifelse($3,,auto,$3)<]>changequote([,]),[
        ol_arg=invalid
        for ol_val in ifelse($4,,[auto yes no],[$4]) ; do
                if test "$enableval" = "$ol_val" ; then
@@ -38,7 +38,7 @@ dnl $2 = help-string
 dnl $3 = default value (no)
 dnl $4 = allowed values (yes or no)
 AC_DEFUN([OL_ARG_WITH], [# OpenLDAP --with-$1
-       AC_ARG_WITH($1,[$2 (]ifelse($3,,yes,$3)[)],[
+       AC_ARG_WITH($1,changequote(<,>)<$2 [>ifelse($3,,yes,$3)<]>changequote([,]),[
        ol_arg=invalid
        for ol_val in ifelse($4,,[yes no],[$4]) ; do
                if test "$withval" = "$ol_val" ; then
@@ -265,7 +265,9 @@ AC_DEFUN([OL_BERKELEY_DB_TRY],
 #define NULL ((void*)0)
 #endif
 ],[
-#if DB_VERSION_MAJOR > 1
+#if DB_VERSION_MAJOR > 2
+       db_env_create( NULL, 0 );
+#elif DB_VERSION_MAJOR > 1
        db_appexit( NULL );
 #else
        (void) dbopen( NULL, 0, 0, 0, NULL);
@@ -313,9 +315,23 @@ AC_DEFUN([OL_BERKELEY_DB_THREAD],
 main()
 {
        int rc;
-       DB_ENV env;
        u_int32_t flags = DB_CREATE | DB_THREAD;
 
+#if DB_VERSION_MAJOR > 2
+       DB_ENV *env = NULL;
+
+       rc = db_env_create( &env, 0 );
+
+       if( rc == 0 ) {
+#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
+               rc = env->open( env, NULL, flags, 0 );
+#else
+               rc = env->open( env, NULL, NULL, flags, 0 );
+#endif
+       }
+
+#else
+       DB_ENV env;
        memset( &env, '\0', sizeof(env) );
 
        rc = db_appinit( NULL, NULL, &env, flags );
@@ -323,6 +339,14 @@ main()
        if( rc == 0 ) {
                db_appexit( &env );
        }
+#endif
+#if DB_VERSION_MAJOR > 2
+#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
+       env->remove( env, NULL, DB_FORCE);
+#else
+       env->remove( env, NULL, NULL, DB_FORCE);
+#endif
+#endif
 
        return rc;
 }],
@@ -595,18 +619,22 @@ AC_DEFUN([OL_PTHREAD_TEST_FUNCTION],[
        status = pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_UNDETACHED);
        if( status ) exit( status );
 
-#define        ATTR    &attr
-#else
-#if HAVE_PTHREADS_D4
-#define        ATTR    pthread_attr_default
+#      define  ATTR    &attr
+#elif defined( HAVE_PTHREADS_D4 )
+#      define  ATTR    pthread_attr_default
 #else
-#define        ATTR    NULL
-#endif
+#      define  ATTR    NULL
 #endif
+
        /* make sure pthread_create() isn't just a stub */
        status = pthread_create(&t, ATTR, task, NULL);
        if( status ) exit( status );
 
+       /* give the thread a chance to complete...
+     * it should remain joinable and hence detachable
+        */
+       sleep( 1 );
+
        /* make sure pthread_detach() isn't just a stub */
 #if HAVE_PTHREADS_D4
        status = pthread_detach( &t );
@@ -680,13 +708,9 @@ AC_DEFUN([OL_HEADER_GNU_PTH_PTHREAD_H], [
 dnl ====================================================================
 dnl Check for NT Threads
 AC_DEFUN([OL_NT_THREADS], [
-       AC_CACHE_CHECK([for NT Threads], [ol_cv_nt_threads], [
-               AC_CHECK_FUNC(_beginthread,
-                       [ol_cv_nt_threads=yes],
-                       [ol_cv_nt_threads=no])
-       ])
+       AC_CHECK_FUNC(_beginthread)
 
-       if test $ol_cv_nt_threads = yes ; then
+       if test $ac_cv_func__beginthread = yes ; then
                AC_DEFINE(HAVE_NT_THREADS,1,[if you have NT Threads])
        fi
 ])
@@ -717,7 +741,7 @@ dnl defines ol_cv_sys_linux_threads to 'yes' or 'no'
 dnl    'no' implies pthreads implementation is not LinuxThreads.
 dnl 
 AC_DEFUN([OL_SYS_LINUX_THREADS], [
-       AC_CHECK_FUNC(pthread_kill_other_threads_np)
+       AC_CHECK_FUNCS(pthread_kill_other_threads_np)
        AC_CACHE_CHECK([for LinuxThreads implementation],
                [ol_cv_sys_linux_threads],
                [ol_cv_sys_linux_threads=$ac_cv_func_pthread_kill_other_threads_np])