From 8b057e2117d2d0a3a73134f37367d42de6ed1671 Mon Sep 17 00:00:00 2001 From: Ossama Othman Date: Wed, 5 Feb 2003 21:50:38 +0000 Subject: ChangeLogTag:Wed Feb 5 13:50:09 2003 Ossama Othman --- ChangeLog | 18 ++++ ChangeLogs/ChangeLog-03a | 18 ++++ configure.ac | 210 ++++++++++++++++++++++++++++++++++++----------- m4/config_h.m4 | 5 ++ 4 files changed, 201 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b17cc6e57c..e3d3ad90519 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +Wed Feb 5 13:50:09 2003 Ossama Othman + + * configure.ac: + + Added check for snprintf(). + + Added check for mutex timeouts (e.g. pthread_mutex_timedlock()). + + Updated STL map and queue conflict tests to take into account + the "std" namespace, if necessary. + + Updated "new() throws bad_alloc" test to take into account the + "std" namespace, if necessary. + + * m4/config_h.m4 (ACE_HAS_SNPRINTF, ACE_HAS_MUTEX_TIMEOUTS): + + Added autoheader templates for these macros. + Wed Feb 5 11:54:22 2003 Ossama Othman * Makefile.am: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 9b17cc6e57c..e3d3ad90519 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,21 @@ +Wed Feb 5 13:50:09 2003 Ossama Othman + + * configure.ac: + + Added check for snprintf(). + + Added check for mutex timeouts (e.g. pthread_mutex_timedlock()). + + Updated STL map and queue conflict tests to take into account + the "std" namespace, if necessary. + + Updated "new() throws bad_alloc" test to take into account the + "std" namespace, if necessary. + + * m4/config_h.m4 (ACE_HAS_SNPRINTF, ACE_HAS_MUTEX_TIMEOUTS): + + Added autoheader templates for these macros. + Wed Feb 5 11:54:22 2003 Ossama Othman * Makefile.am: diff --git a/configure.ac b/configure.ac index 6524fb822c0..24079223441 100644 --- a/configure.ac +++ b/configure.ac @@ -909,54 +909,6 @@ AC_CHECK_HEADER([cstring], AC_CHECK_HEADER([memory],,) -AC_CHECK_HEADER([map], -[ - AC_CHECK_HEADER([net/if.h], - [ - ACE_CACHE_CHECK([if STL map class conflicts with map struct], - [ace_cv_header_stl_map_conflict], - [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifndef ACE_LACKS_SYS_TYPES_H -# include -#endif -#include -#include - ]],[[ - map ace_map; - ]])],[ - ace_cv_header_stl_map_conflict=no - ],[ - ace_cv_header_stl_map_conflict=yes - ]) - ],[AC_DEFINE([ACE_HAS_STL_MAP_CONFLICT])],) - ],) -],) - -AC_CHECK_HEADER([queue], -[ - AC_CHECK_HEADER([netinet/in.h], - [ - ACE_CACHE_CHECK([if STL queue class conflicts with queue struct], - [ace_cv_header_stl_queue_conflict], - [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#ifndef ACE_LACKS_SYS_TYPES_H -# include -#endif -#include -#include - ]],[[ - queue ace_queue; - ]])],[ - ace_cv_header_stl_queue_conflict=no - ],[ - ace_cv_header_stl_queue_conflict=yes - ]) - ],[AC_DEFINE([ACE_HAS_STL_QUEUE_CONFLICT])],) - ],) -],) - dnl Check for availablity of "new style" C++ stream headers AC_CHECK_HEADERS([iomanip ios iostream istream ostream fstream streambuf], , @@ -2031,6 +1983,62 @@ ACE_CACHE_CHECK([for new style C++ include file support], AC_DEFINE([ACE_HAS_STRING_CLASS]) ],) +AC_CHECK_HEADER([map], +[ + AC_CHECK_HEADER([net/if.h], + [ + ACE_CACHE_CHECK([if STL map class conflicts with map struct], + [ace_cv_header_stl_map_conflict], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifndef ACE_LACKS_SYS_TYPES_H +# include +#endif +#include +#include + ]],[[ +#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB + std::map ace_map; +#else + map ace_map; +#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ + ]])],[ + ace_cv_header_stl_map_conflict=no + ],[ + ace_cv_header_stl_map_conflict=yes + ]) + ],[AC_DEFINE([ACE_HAS_STL_MAP_CONFLICT])],) + ],) +],) + +AC_CHECK_HEADER([queue], +[ + AC_CHECK_HEADER([netinet/in.h], + [ + ACE_CACHE_CHECK([if STL queue class conflicts with queue struct], + [ace_cv_header_stl_queue_conflict], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifndef ACE_LACKS_SYS_TYPES_H +# include +#endif +#include +#include + ]],[[ +#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB + std::queue ace_queue; +#else + queue ace_queue; +#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ + ]])],[ + ace_cv_header_stl_queue_conflict=no + ],[ + ace_cv_header_stl_queue_conflict=yes + ]) + ],[AC_DEFINE([ACE_HAS_STL_QUEUE_CONFLICT])],) + ],) +],) + dnl Check whether platform supports the standard C++ library dnl TODO: For now, check whether headers , dnl and exist; is there a better way? @@ -3792,6 +3800,9 @@ AC_CHECK_FUNC([shm_open], dnl AC_DEFINE([ACE_HAS_SHM_OPEN]) ],) +AC_CHECK_FUNC([snprintf], + [AC_DEFINE([ACE_HAS_SNPRINTF])],) + AC_CHECK_FUNC([tempnam], , [AC_DEFINE([ACE_LACKS_TEMPNAM])]) @@ -4187,7 +4198,7 @@ dnl Check if platform has thread_self() rather than pthread_self() ]) dnl Check if pthread.h declares an enum with PTHREAD_PROCESS_PRIVATE and -dnl PTHREAD_PROCESS_SHARED valuesACE_CACHE_CHECK(for ctime() macro, +dnl PTHREAD_PROCESS_SHARED values. ACE_CACHE_CHECK([for PTHREAD_PROCESS_* enumeration in pthread.h], [ace_cv_lib_pthread_process_enum], [ @@ -4562,7 +4573,7 @@ dnl Check if "getby" functions use a non-const char * argument dnl Check if new throws exception upon failure if test "$ace_user_enable_exceptions" = yes; then - ACE_CACHE_CHECK([if new throws bad_alloc exception on failure], + ACE_CACHE_CHECK([if new throws std::bad_alloc exception on failure], [ace_cv_new_throws_bad_alloc_exception], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -4587,7 +4598,11 @@ if test "$ace_user_enable_exceptions" = yes; then } } +#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB + catch (std::bad_alloc) +#else catch (bad_alloc) +#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ { return 0; /* new() does throw exceptions */ } @@ -6630,6 +6645,101 @@ main () ]) ], , [AC_DEFINE([ACE_LACKS_NULL_PTHREAD_STATUS])]) + dnl Check if OS supports timed mutex acquisitions + dnl (e.g. pthread_mutex_timedlock()). + ACE_CACHE_CHECK([for timed mutex acquisitions], + [ace_cv_have_mutex_timeouts],[ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#ifndef _REENTRANT +#define _REENTRANT +#endif + +#include + +/* _THREAD_SAFE is defined in on some platforms. */ +#ifndef _THREAD_SAFE +#define _THREAD_SAFE +#endif + +#include + +#include +#include + +#ifndef ACE_LACKS_UNISTD_H +# include +#endif + + +pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + +#ifdef __cplusplus +extern "C" +#endif +void *threadFunc (void *parm) +{ + int rc; + int i; + struct timespec deltatime; + struct timeval tv; + + if (gettimeofday (&tv, 0) != 0) + { + return 0; + } + + deltatime.tv_sec = tv.tv_sec + 5; + deltatime.tv_nsec = 0; + + rc = pthread_mutex_timedlock (&mutex, &deltatime); + + if (rc != ETIMEDOUT) + { + /* printf("Got an incorrect return code from pthread_mutex_timedlock\n"); */ + } + + return 0; +} + +int main (void) +{ + int rc =0; + pthread_t thread; + + rc = pthread_mutex_lock (&mutex); + if (rc != 0) + { + exit (-1); + } + + rc = pthread_create (&thread, NULL, threadFunc, NULL); + if (rc != 0) + { + exit (-1); + } + + rc = pthread_join (thread, NULL); + if (rc != 0) + { + exit (-1); + } + + pthread_mutex_destroy (&mutex); + + return 0; +} + ]])],[ + ace_cv_have_mutex_timeouts=yes + ],[ + ace_cv_have_mutex_timeouts=no + ],[ + dnl Cross-compiled case + AC_CHECK_FUNC([pthread_mutex_timedlock], + [ace_cv_have_mutex_timeouts=yes], + [ace_cv_have_mutex_timeouts=no]) + ]) + ], [AC_DEFINE([ACE_HAS_MUTEX_TIMEOUTS])],) + dnl Check if platform needs to #include to get thread dnl scheduling defs. ACE_CACHE_CHECK([if sched.h is needed for thread scheduling definitions], diff --git a/m4/config_h.m4 b/m4/config_h.m4 index dab952edd46..8bb451540ee 100644 --- a/m4/config_h.m4 +++ b/m4/config_h.m4 @@ -788,6 +788,8 @@ AH_TEMPLATE([ACE_HAS_SIN_LEN],[Platform supports new BSD inet_addr len field.]) AH_TEMPLATE([ACE_HAS_SIZET_SOCKET_LEN], [OS/compiler uses size_t * rather than int * for socket lengths]) +AH_TEMPLATE([ACE_HAS_SNPRINTF],[Platform offers snprintf().]) + AH_TEMPLATE([ACE_HAS_SOCKADDR_MSG_NAME], [Platform requires (struct sockaddr *) for msg_name field of struct msghdr.]) @@ -1105,6 +1107,9 @@ AH_TEMPLATE([ACE_LACKS_MUTEXATTR_PSHARED], AH_TEMPLATE([ACE_LACKS_NULL_PTHREAD_STATUS], [OS requires non-null status pointer for pthread_join ()]) +AH_TEMPLATE([ACE_HAS_MUTEX_TIMEOUTS], +[Compiler supports timed mutex acquisitions (e.g. pthread_mutex_timedlock()).]) + AH_TEMPLATE([ACE_LACKS_PARAM_H],[Platform lacks (e.g., MVS)]) AH_TEMPLATE([ACE_LACKS_NAMED_POSIX_SEM], -- cgit v1.2.1