Hack to compile on systems that have but don't declare pthread_mutexattr_settype.
git-svn-id: http://voip.null.ro/svn/yate@135 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
db6f854dc7
commit
e5b82aa227
|
@ -202,6 +202,9 @@ Engine.o: @srcdir@/Engine.cpp $(MKDEPS) @srcdir@/telengine.h yateversn.h yatepat
|
|||
DataBlock.o: @srcdir@/DataBlock.cpp $(MKDEPS) @srcdir@/telengine.h @srcdir@/telephony.h
|
||||
$(COMPILE) -c $<
|
||||
|
||||
Mutex.o: @srcdir@/Mutex.cpp $(MKDEPS) @srcdir@/telengine.h
|
||||
$(COMPILE) @MUTEX_HACK@ -c $<
|
||||
|
||||
%.o: @srcdir@/%.cpp $(MKDEPS) @srcdir@/telengine.h
|
||||
$(COMPILE) -c $<
|
||||
|
||||
|
|
|
@ -11,4 +11,4 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
autoconf
|
||||
autoconf && echo "Finished! Now run configure. If in doubt run ./configure --help"
|
||||
|
|
27
configure.in
27
configure.in
|
@ -47,7 +47,32 @@ AC_CACHE_SAVE
|
|||
|
||||
# Checks for required libraries.
|
||||
AC_CHECK_LIB([dl], [dlopen], , [AC_MSG_ERROR([This library is required.])])
|
||||
AC_CHECK_LIB([pthread], [pthread_create], , [AC_MSG_ERROR([This library is required.])])
|
||||
AC_CHECK_LIB([pthread], [pthread_mutexattr_settype], , [AC_MSG_ERROR([This library is required.])])
|
||||
|
||||
MUTEX_HACK=""
|
||||
AC_MSG_CHECKING([for pthread_mutexattr_settype declaration])
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wall -Werror"
|
||||
AC_TRY_COMPILE([],[
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
void f(void){
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE_NP);
|
||||
}
|
||||
],
|
||||
have_mutex_settype="yes",
|
||||
have_mutex_settype="no"
|
||||
)
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
if [[ "$have_mutex_settype" = "no" ]]; then
|
||||
MUTEX_HACK="-DMUTEX_HACK"
|
||||
fi
|
||||
AC_MSG_RESULT([$have_mutex_settype])
|
||||
AC_SUBST(MUTEX_HACK)
|
||||
|
||||
# Check for compile options
|
||||
INLINE_FLAGS=""
|
||||
|
|
|
@ -25,6 +25,12 @@
|
|||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef MUTEX_HACK
|
||||
extern "C" {
|
||||
extern int pthread_mutexattr_settype(pthread_mutexattr_t *__attr, int __kind) __THROW;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace TelEngine {
|
||||
|
||||
class MutexPrivate {
|
||||
|
|
Loading…
Reference in New Issue