mirror of
https://github.com/asterisk/asterisk.git
synced 2026-04-29 10:13:06 +00:00
Fix a build problem on Mac OS X with DEBUG_THREADS enabled.
This set of changes was already in trunk. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@271339 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
14
configure.ac
14
configure.ac
@@ -422,6 +422,20 @@ if test "${ac_cv_pthread_once_needsbraces}" = "yes"; then
|
||||
AC_DEFINE([PTHREAD_ONCE_INIT_NEEDS_BRACES], 1, [Define if your system needs braces around PTHREAD_ONCE_INIT])
|
||||
fi
|
||||
|
||||
# Can we compare a mutex to its initial value?
|
||||
# Generally yes on OpenBSD/FreeBSD and no on Mac OS X.
|
||||
AC_MSG_CHECKING(whether we can compare a mutex to its initial value)
|
||||
AC_LINK_IFELSE(
|
||||
AC_LANG_PROGRAM([#include <pthread.h>], [pthread_mutex_t lock;
|
||||
if ((lock) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||
return 0;
|
||||
}
|
||||
return 0]),
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([CAN_COMPARE_MUTEX_TO_INIT_VALUE], 1, [Define to 1 if the implementation of mutexes supports comparison of a mutex to its initializer.]),
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for compiler atomic operations)
|
||||
AC_LINK_IFELSE(
|
||||
AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);]),
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
/* Define to 1 if internal poll should be used. */
|
||||
#undef AST_POLL_COMPAT
|
||||
|
||||
/* Define to 1 if the implementation of mutexes supports comparison of a mutex
|
||||
to its initializer. */
|
||||
#undef CAN_COMPARE_MUTEX_TO_INIT_VALUE
|
||||
|
||||
/* Define to 1 if the `closedir' function returns void instead of `int'. */
|
||||
#undef CLOSEDIR_VOID
|
||||
|
||||
@@ -463,7 +467,7 @@
|
||||
/* Define to 1 if you have the `strtoq' function. */
|
||||
#undef HAVE_STRTOQ
|
||||
|
||||
/* Define to 1 if `st_blksize' is member of `struct stat'. */
|
||||
/* Define to 1 if `st_blksize' is a member of `struct stat'. */
|
||||
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
|
||||
/* Define to 1 if you have the mISDN Supplemental Services library. */
|
||||
@@ -652,12 +656,12 @@
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if the C compiler supports function prototypes. */
|
||||
#undef PROTOTYPES
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
@@ -677,11 +681,6 @@
|
||||
/* Define to the type of arg 5 for `select'. */
|
||||
#undef SELECT_TYPE_ARG5
|
||||
|
||||
/* Define to 1 if the `setvbuf' function takes the buffering type as its
|
||||
second argument and the buffer pointer as the third, as on System V before
|
||||
release 3. */
|
||||
#undef SETVBUF_REVERSED
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
@@ -702,20 +701,30 @@
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Define to 1 if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
|
||||
#undef _LARGEFILE_SOURCE
|
||||
@@ -733,20 +742,6 @@
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Enable extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
|
||||
/* Define like PROTOTYPES; this can be used by system headers. */
|
||||
#undef __PROTOTYPES
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ static inline int __ast_pthread_mutex_init(int track, const char *filename, int
|
||||
int res;
|
||||
pthread_mutexattr_t attr;
|
||||
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
|
||||
if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||
/*
|
||||
@@ -296,7 +296,7 @@ static inline int __ast_pthread_mutex_destroy(const char *filename, int lineno,
|
||||
int res;
|
||||
int canlog = strcmp(filename, "logger.c") & t->track;
|
||||
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||
/* Don't try to uninitialize non initialized mutex
|
||||
* This may no effect on linux
|
||||
@@ -354,7 +354,7 @@ static inline int __ast_pthread_mutex_lock(const char *filename, int lineno, con
|
||||
int res;
|
||||
int canlog = strcmp(filename, "logger.c") & t->track;
|
||||
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||
/* Don't warn abount uninitialized mutex.
|
||||
* Simple try to initialize it.
|
||||
@@ -442,7 +442,7 @@ static inline int __ast_pthread_mutex_trylock(const char *filename, int lineno,
|
||||
int res;
|
||||
int canlog = strcmp(filename, "logger.c") & t->track;
|
||||
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||
/* Don't warn abount uninitialized mutex.
|
||||
* Simple try to initialize it.
|
||||
@@ -488,7 +488,7 @@ static inline int __ast_pthread_mutex_unlock(const char *filename, int lineno, c
|
||||
int res;
|
||||
int canlog = strcmp(filename, "logger.c") & t->track;
|
||||
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||
filename, lineno, func, mutex_name);
|
||||
@@ -567,7 +567,7 @@ static inline int __ast_cond_wait(const char *filename, int lineno, const char *
|
||||
int res;
|
||||
int canlog = strcmp(filename, "logger.c") & t->track;
|
||||
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||
filename, lineno, func, mutex_name);
|
||||
@@ -638,7 +638,7 @@ static inline int __ast_cond_timedwait(const char *filename, int lineno, const c
|
||||
int res;
|
||||
int canlog = strcmp(filename, "logger.c") & t->track;
|
||||
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
if ((t->mutex) == ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
|
||||
__ast_mutex_logger("%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
|
||||
filename, lineno, func, mutex_name);
|
||||
@@ -862,7 +862,7 @@ static inline int __ast_rwlock_init(const char *filename, int lineno, const char
|
||||
{
|
||||
int res;
|
||||
pthread_rwlockattr_t attr;
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
int canlog = strcmp(filename, "logger.c");
|
||||
|
||||
if (*prwlock != ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
|
||||
@@ -889,7 +889,7 @@ static inline int __ast_rwlock_destroy(const char *filename, int lineno, const c
|
||||
int res;
|
||||
int canlog = strcmp(filename, "logger.c");
|
||||
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
if (*prwlock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
|
||||
__ast_mutex_logger("%s line %d (%s): Warning: rwlock '%s' is uninitialized.\n",
|
||||
filename, lineno, func, rwlock_name);
|
||||
@@ -911,7 +911,7 @@ static inline int _ast_rwlock_unlock(ast_rwlock_t *lock, const char *name,
|
||||
const char *file, int line, const char *func)
|
||||
{
|
||||
int res;
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
int canlog = strcmp(file, "logger.c");
|
||||
|
||||
if (*lock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
|
||||
@@ -938,7 +938,7 @@ static inline int _ast_rwlock_rdlock(ast_rwlock_t *lock, const char *name,
|
||||
const char *file, int line, const char *func)
|
||||
{
|
||||
int res;
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
int canlog = strcmp(file, "logger.c");
|
||||
|
||||
if (*lock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
|
||||
@@ -971,7 +971,7 @@ static inline int _ast_rwlock_wrlock(ast_rwlock_t *lock, const char *name,
|
||||
const char *file, int line, const char *func)
|
||||
{
|
||||
int res;
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
int canlog = strcmp(file, "logger.c");
|
||||
|
||||
if (*lock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
|
||||
@@ -1004,7 +1004,7 @@ static inline int _ast_rwlock_timedrdlock(ast_rwlock_t *lock, const char *name,
|
||||
const struct timespec *abs_timeout, const char *file, int line, const char *func)
|
||||
{
|
||||
int res;
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
int canlog = strcmp(file, "logger.c");
|
||||
|
||||
if (*lock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
|
||||
@@ -1053,7 +1053,7 @@ static inline int _ast_rwlock_timedwrlock(ast_rwlock_t *lock, const char *name,
|
||||
const struct timespec *abs_timeout, const char *file, int line, const char *func)
|
||||
{
|
||||
int res;
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
int canlog = strcmp(file, "logger.c");
|
||||
|
||||
if (*lock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
|
||||
@@ -1102,7 +1102,7 @@ static inline int _ast_rwlock_tryrdlock(ast_rwlock_t *lock, const char *name,
|
||||
const char *file, int line, const char *func)
|
||||
{
|
||||
int res;
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
int canlog = strcmp(file, "logger.c");
|
||||
|
||||
if (*lock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
|
||||
@@ -1135,7 +1135,7 @@ static inline int _ast_rwlock_trywrlock(ast_rwlock_t *lock, const char *name,
|
||||
const char *file, int line, const char *func)
|
||||
{
|
||||
int res;
|
||||
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
|
||||
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
|
||||
int canlog = strcmp(file, "logger.c");
|
||||
|
||||
if (*lock == ((ast_rwlock_t) AST_RWLOCK_INIT_VALUE)) {
|
||||
|
||||
Reference in New Issue
Block a user