forked from enlightenment/efl
split out spinlock detection to separate macro for readability, add rwlock detection macro
***no functional changes*** SVN revision: 50910
This commit is contained in:
parent
ed0f5eb857
commit
76a70bdd48
|
@ -84,7 +84,7 @@ EFL_CHECK_CPU_SSE([have_sse="yes"], [have_sse="no"])
|
||||||
EFL_CHECK_CPU_SSE2([have_sse2="yes"], [have_sse2="no"])
|
EFL_CHECK_CPU_SSE2([have_sse2="yes"], [have_sse2="no"])
|
||||||
EFL_CHECK_CPU_ALTIVEC([have_altivec="yes"], [have_altivec="no"])
|
EFL_CHECK_CPU_ALTIVEC([have_altivec="yes"], [have_altivec="no"])
|
||||||
|
|
||||||
EFL_CHECK_THREADS(["yes"],
|
EFL_CHECK_THREADS(
|
||||||
[
|
[
|
||||||
if test "x${_efl_have_posix_threads}" = "xyes" ; then
|
if test "x${_efl_have_posix_threads}" = "xyes" ; then
|
||||||
have_threads="POSIX"
|
have_threads="POSIX"
|
||||||
|
@ -96,9 +96,9 @@ EFL_CHECK_THREADS(["yes"],
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
],
|
],
|
||||||
[have_threads="no"],
|
[have_threads="no"])
|
||||||
[have_posix_threads_spinlock="yes"],
|
EFL_CHECK_SPINLOCK([have_posix_threads_spinlock="yes"], [have_posix_threads_spinlock="no"])
|
||||||
[have_posix_threads_spinlock="no"])
|
EFL_CHECK_RWLOCK([have_posix_threads_rwlock="yes"], [have_posix_threads_rwlock="no"])
|
||||||
|
|
||||||
### Additional options to configure
|
### Additional options to configure
|
||||||
|
|
||||||
|
@ -591,11 +591,10 @@ echo " Safety checks........: ${have_safety_checks}"
|
||||||
echo " Maximum log level....: ${with_max_log_level}"
|
echo " Maximum log level....: ${with_max_log_level}"
|
||||||
echo " Report string usage..: ${have_stringshare_usage}"
|
echo " Report string usage..: ${have_stringshare_usage}"
|
||||||
echo " Default mempool......: ${have_default_mempool}"
|
echo " Default mempool......: ${have_default_mempool}"
|
||||||
echo $ECHO_N " Thread Support.......: ${have_threads}$ECHO_C"
|
echo " Thread Support.......: ${have_threads}"
|
||||||
if test "${have_threads}" = "POSIX" ; then
|
if test "${have_threads}" = "POSIX" ; then
|
||||||
echo " (spinlock: ${have_posix_threads_spinlock})"
|
echo " spinlock...........: ${have_posix_threads_spinlock}"
|
||||||
else
|
echo " rwlock.............: ${have_posix_threads_rwlock}"
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
echo " Amalgamation.........: ${do_amalgamation}"
|
echo " Amalgamation.........: ${do_amalgamation}"
|
||||||
echo " Iconv support........: ${have_iconv}"
|
echo " Iconv support........: ${have_iconv}"
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
|
dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
|
||||||
dnl That code is public domain and can be freely used or copied.
|
dnl rwlock code added by Mike Blumenkrantz <mike at zentific dot com>
|
||||||
|
dnl This code is public domain and can be freely used or copied.
|
||||||
|
|
||||||
dnl Macro that check if POSIX or Win32 threads library is available or not.
|
dnl Macro that check if POSIX or Win32 threads library is available or not.
|
||||||
|
|
||||||
dnl Usage: EFL_CHECK_THREADS(want_pthread_spin[, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
dnl Usage: EFL_CHECK_THREADS(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||||
dnl Call AC_SUBST(EFL_PTHREAD_CFLAGS)
|
dnl Call AC_SUBST(EFL_PTHREAD_CFLAGS)
|
||||||
dnl Call AC_SUBST(EFL_PTHREAD_LIBS)
|
dnl Call AC_SUBST(EFL_PTHREAD_LIBS)
|
||||||
dnl Define EFL_HAVE_POSIX_THREADS or EFL_HAVE_WIN32_THREADS, and EFL_HAVE_THREADS
|
dnl Defines EFL_HAVE_POSIX_THREADS or EFL_HAVE_WIN32_THREADS, and EFL_HAVE_THREADS
|
||||||
dnl Define EFL_HAVE_POSIX_THREADS_SPINLOCK
|
|
||||||
|
|
||||||
AC_DEFUN([EFL_CHECK_THREADS],
|
AC_DEFUN([EFL_CHECK_THREADS],
|
||||||
[
|
[
|
||||||
|
@ -138,11 +138,29 @@ if test "x${_efl_have_posix_threads}" = "xyes" ; then
|
||||||
AC_DEFINE([EFL_HAVE_POSIX_THREADS], [1], [Define to mention that POSIX threads are supported])
|
AC_DEFINE([EFL_HAVE_POSIX_THREADS], [1], [Define to mention that POSIX threads are supported])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "x${_efl_enable_win32_threads}" = "xyes" ; then
|
||||||
|
_efl_have_win32_threads="yes"
|
||||||
|
AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 threads are supported])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x${_efl_have_posix_threads}" = "xyes" || test "x${_efl_have_win32_threads}" = "xyes" ; then
|
||||||
|
AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$1], [$2])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl Usage: EFL_CHECK_SPINLOCK(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||||
|
dnl Defines EFL_HAVE_POSIX_THREADS_SPINLOCK
|
||||||
|
AC_DEFUN([EFL_CHECK_SPINLOCK],
|
||||||
|
[
|
||||||
|
|
||||||
dnl check if the compiler supports pthreads spinlock
|
dnl check if the compiler supports pthreads spinlock
|
||||||
|
|
||||||
_efl_have_posix_threads_spinlock="no"
|
_efl_have_posix_threads_spinlock="no"
|
||||||
|
|
||||||
if test "x${_efl_have_posix_threads}" = "xyes" && test "x$1" = "xyes" ; then
|
if test "x${_efl_have_posix_threads}" = "xyes" ; then
|
||||||
|
|
||||||
SAVE_CFLAGS=${CFLAGS}
|
SAVE_CFLAGS=${CFLAGS}
|
||||||
CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
|
CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
|
||||||
|
@ -166,24 +184,55 @@ fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
|
AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
|
||||||
AC_MSG_RESULT([${_efl_have_posix_threads_spinlock}])
|
AC_MSG_RESULT([${_efl_have_posix_threads_spinlock}])
|
||||||
if test "x${_efl_enable_posix_threads}" = "xyes" && test "x${_efl_have_posix_threads_spinlock}" = "xno" && test "x$1" = "xyes" ; then
|
if test "x${_efl_enable_posix_threads}" = "xyes" && test "x${_efl_have_posix_threads_spinlock}" = "xno" ; then
|
||||||
AC_MSG_WARN([POSIX threads support requested but spinlocks are not supported])
|
AC_MSG_WARN([POSIX threads support requested but spinlocks are not supported])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x${_efl_have_posix_threads_spinlock}" = "xyes" ; then
|
if test "x${_efl_have_posix_threads_spinlock}" = "xyes" ; then
|
||||||
AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that POSIX threads spinlocks are supported])
|
AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that POSIX threads spinlocks are supported])
|
||||||
fi
|
fi
|
||||||
|
AS_IF([test "x$_efl_have_posix_threads_spinlock" = "xyes"], [$1], [$2])
|
||||||
if test "x${_efl_enable_win32_threads}" = "xyes" ; then
|
])
|
||||||
_efl_have_win32_threads="yes"
|
|
||||||
AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 threads are supported])
|
|
||||||
fi
|
dnl Usage: EFL_CHECK_RWLOCK(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||||
|
dnl Defines EFL_HAVE_POSIX_THREADS_RWLOCK
|
||||||
if test "x${_efl_have_posix_threads}" = "xyes" || test "x${_efl_have_win32_threads}" = "xyes" ; then
|
AC_DEFUN([EFL_CHECK_RWLOCK],
|
||||||
AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
|
[
|
||||||
fi
|
dnl check if the compiler supports pthreads rwlock
|
||||||
|
|
||||||
AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$2], [$3])
|
_efl_have_posix_threads_rwlock="no"
|
||||||
AS_IF([test "x$_efl_have_posix_threads_spinlock" = "xyes"], [$4], [$5])
|
|
||||||
|
if test "x${_efl_have_posix_threads}" = "xyes" ; then
|
||||||
|
|
||||||
|
SAVE_CFLAGS=${CFLAGS}
|
||||||
|
CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
|
||||||
|
SAVE_LIBS=${LIBS}
|
||||||
|
LIBS="${LIBS} ${EFL_PTHREAD_LIBS}"
|
||||||
|
AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([[
|
||||||
|
#include <pthread.h>
|
||||||
|
]],
|
||||||
|
[[
|
||||||
|
pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER;
|
||||||
|
int res;
|
||||||
|
res = pthread_rwlock_init(&lock, PTHREAD_PROCESS_PRIVATE);
|
||||||
|
]])],
|
||||||
|
[_efl_have_posix_threads_rwlock="yes"],
|
||||||
|
[_efl_have_posix_threads_rwlock="no"])
|
||||||
|
CFLAGS=${SAVE_CFLAGS}
|
||||||
|
LIBS=${SAVE_LIBS}
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([whether to build POSIX threads rwlock code])
|
||||||
|
AC_MSG_RESULT([${_efl_have_posix_threads_rwlock}])
|
||||||
|
if test "x${_efl_enable_posix_threads}" = "xyes" && test "x${_efl_have_posix_threads_rwlock}" = "xno" ; then
|
||||||
|
AC_MSG_WARN([POSIX threads support requested but rwlocks are not supported])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x${_efl_have_posix_threads_rwlock}" = "xyes" ; then
|
||||||
|
AC_DEFINE([EFL_HAVE_POSIX_THREADS_RWLOCK], [1], [Define to mention that POSIX threads rwlocks are supported])
|
||||||
|
fi
|
||||||
|
AS_IF([test "x$_efl_have_posix_threads_rwlock" = "xyes"], [$1], [$2])
|
||||||
])
|
])
|
||||||
|
|
Loading…
Reference in New Issue