X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=build%2Fopenldap.m4;h=b64a4fcf65147138d1dc07a52758cc1197cfe70d;hb=5ad8efbb473f14d52a16e11862559ae5133c7469;hp=2db4042fb098a5a0d04b58a88f2a266a5c748844;hpb=063691aec09f4ec584f7004bcc443c8d6c3dac75;p=openldap diff --git a/build/openldap.m4 b/build/openldap.m4 index 2db4042fb0..b64a4fcf65 100644 --- a/build/openldap.m4 +++ b/build/openldap.m4 @@ -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,6 +265,24 @@ AC_DEFUN([OL_BERKELEY_DB_TRY], #define NULL ((void*)0) #endif ],[ +#if DB_VERSION_MAJOR > 1 + { + char *version; + int major, minor, patch; + + version = db_version( &major, &minor, &patch ); + + if( major != DB_VERSION_MAJOR || + minor < DB_VERSION_MINOR ) + { + printf("Berkeley DB version mismatch\n" + "\texpected: %s\n\tgot: %s\n", + DB_VERSION_STRING, version); + return 1; + } + } +#endif + #if DB_VERSION_MAJOR > 2 db_env_create( NULL, 0 ); #elif DB_VERSION_MAJOR > 1 @@ -315,19 +333,47 @@ AC_DEFUN([OL_BERKELEY_DB_THREAD], main() { int rc; - u_int32_t flags = DB_CREATE | DB_THREAD; + u_int32_t flags = DB_CREATE | DB_INIT_CDB | DB_INIT_MPOOL | +#ifdef DB_PRIVATE + DB_PRIVATE | +#endif +#ifdef DB_MPOOL_PRIVATE + DB_MPOOL_PRIVATE | +#endif + DB_THREAD; #if DB_VERSION_MAJOR > 2 DB_ENV *env = NULL; rc = db_env_create( &env, 0 ); - if( rc == 0 ) { + if( rc ) { + printf("BerkeleyDB: %s\n", db_strerror(rc) ); + return rc; + } + +#ifdef DB_CDB_ALLDB + rc = env->set_flags( env, DB_CDB_ALLDB, 1 ); + + if( rc ) { + printf("BerkeleyDB: %s\n", db_strerror(rc) ); + return rc; + } +#endif + #if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1) - rc = env->open( env, NULL, flags, 0 ); + rc = env->open( env, NULL, flags, 0 ); #else - rc = env->open( env, NULL, NULL, flags, 0 ); + rc = env->open( env, NULL, NULL, flags, 0 ); #endif + + if ( rc == 0 ) { + rc = env->close( env, 0 ); + } + + if( rc ) { + printf("BerkeleyDB: %s\n", db_strerror(rc) ); + return rc; } #else @@ -339,13 +385,9 @@ 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 + + unlink("__db_mpool.share"); + unlink("__db_lock.share"); #endif return rc; @@ -609,40 +651,65 @@ AC_DEFUN([OL_PTHREAD_TEST_FUNCTION],[ /* pthread test function */ pthread_t t; int status; -#if HAVE_PTHREADS_FINAL && defined(PTHREAD_CREATE_UNDETACHED) - /* This system (e.g. AIX) defaults detached; must override */ + int detach = 1; + +#ifdef HAVE_PTHREADS_FINAL + /* Final pthreads */ pthread_attr_t attr; status = pthread_attr_init(&attr); - if( status ) exit( status ); + if( status ) return status; - 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 +#if defined( PTHREAD_CREATE_JOINABLE ) || defined( PTHREAD_UNDETACHED ) + if( !detach ) { +#if defined( PTHREAD_CREATE_JOINABLE ) + status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); #else -#define ATTR NULL + status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_UNDETACHED); #endif + +#ifdef PTHREAD_CREATE_DETACHED + } else { + status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); +#endif + } + if( status ) return status; +#endif + + status = pthread_create( &t, &attr, task, NULL ); + if( status ) return status; + +#if !defined( PTHREAD_CREATE_JOINABLE ) && !defined( PTHREAD_UNDETACHED ) + if( detach ) { + /* give thread a chance to complete */ + /* it should remain joinable and hence detachable */ + sleep( 1 ); + + status = pthread_detach( t ); + if( status ) return status; + } #endif - /* make sure pthread_create() isn't just a stub */ - status = pthread_create(&t, ATTR, task, NULL); - if( status ) exit( status ); - /* make sure pthread_detach() isn't just a stub */ -#if HAVE_PTHREADS_D4 - status = pthread_detach( &t ); #else - status = pthread_detach( t ); + /* Draft 4 pthreads */ + status = pthread_create( &t, pthread_attr_default, task, NULL ); + if( status ) return status; + + if( detach ) { + /* give thread a chance to complete */ + /* it should remain joinable and hence detachable */ + sleep( 1 ); + + status = pthread_detach( &t ); + if( status ) return status; + } #endif #ifdef HAVE_LINUX_THREADS pthread_kill_other_threads_np(); #endif - exit( status ); + return 0; ]) AC_DEFUN([OL_PTHREAD_TEST_PROGRAM], @@ -704,13 +771,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 ])