summaryrefslogtreecommitdiff
path: root/m4/threads.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/threads.m4')
-rw-r--r--m4/threads.m4114
1 files changed, 54 insertions, 60 deletions
diff --git a/m4/threads.m4 b/m4/threads.m4
index 9074e84f748..7b9a7a6d3c0 100644
--- a/m4/threads.m4
+++ b/m4/threads.m4
@@ -50,11 +50,7 @@ dnl Check if compiler accepts specific flag to enable threads
dnl so search for a usable compiler flag to enable thread support.
dnl If no thread flag is found then the remaining tests should still
dnl figure out how to enable thread support via library checks.
- ACE_SEARCH_THREAD_FLAGS(
- [mt pthread pthreads mthreads threads Kthread -thread_safe],,)
- dnl NOTE: "-thread_safe" is correct, not "thread_safe."
- dnl KAI C++ uses the flag "--thread_safe" which is why
- dnl "-thread_safe" is passed as the flag to test.
+ ACE_SEARCH_THREAD_FLAGS(mt pthread pthreads mthreads threads Kthread,,)
],
[
dnl Do nothing
@@ -75,68 +71,66 @@ dnl Check if compiler accepts specific flag to enable threads
ACE_SEARCH_LIBS(rwlock_destroy, thread,,)
dnl Check for POSIX threads
- dnl
- dnl Check if platform provides pthreads backward compatibility macros
- dnl (Some platforms may define some pthread functions such as
- dnl pthread_create() as macros when using a later implementation of
- dnl pthreads. For example, Digital Unix 4.0 #defines a pthread_create
- dnl macro as "__pthread_create" to allow the new implemenation of
- dnl pthread_create() to co-exist with the old implementation of
- dnl of pthread_create().)
-
- ACE_CACHE_CHECK(for pthreads backward compatibility macros,
- ace_cv_lib_pthread_compat_macros,
+ ACE_SEARCH_LIBS(pthread_create, pthread pthreads c_r gthreads,
+ [
+ ace_has_pthreads=yes
+ AC_DEFINE(ACE_HAS_PTHREADS)
+ ],
[
- AC_EGREP_CPP(ACE_PTHREAD_MACROS,
+ dnl Check if platform provides pthreads backward compatibility macros
+ dnl (Some platforms may define some pthread functions such as
+ dnl pthread_create() as macros when using a later implementation of
+ dnl pthreads. For example, Digital Unix 4.0 #defines a pthread_create
+ dnl macro as "__pthread_create" to allow the new implemenation of
+ dnl pthread_create() to co-exist with the old implementation of
+ dnl of pthread_create().)
+
+ ACE_CACHE_CHECK(for pthreads backward compatibility macros,
+ ace_cv_lib_pthread_compat_macros,
[
+ AC_EGREP_CPP(ACE_PTHREAD_MACROS,
+ [
#include <pthread.h>
#if defined (pthread_create)
ACE_PTHREAD_MACROS
#endif
+ ],
+ [
+ ace_cv_lib_pthread_compat_macros=yes
+ ],
+ [
+ ace_cv_lib_pthread_compat_macros=no
+ ])
],
[
- ace_cv_lib_pthread_compat_macros=yes
- ],
- [
- ace_cv_lib_pthread_compat_macros=no
- ])
- ],
- [
- dnl Check if pthread function names are mangled (e.g. DU 4.0)
- dnl to maintain older Pthread Draft compatibility.
- ACE_CHECK_FUNC(pthread_create, pthread.h,
- [
- ace_has_pthreads=yes
- AC_DEFINE(ACE_HAS_PTHREADS)
- ],
- [
- ACE_CHECK_LIB(pthread, pthread_create, pthread.h, dnl
+ dnl Check if pthread function names are mangled (e.g. DU 4.0)
+ dnl to maintain older Pthread Draft compatibility.
+ ACE_CHECK_FUNC(pthread_create, pthread.h,
[
ace_has_pthreads=yes
- dnl Since we AC_DEFINE(ACE_HAS_PTHREADS), the default behavior
- dnl of adding "-lpthread" to the "LIBS" variable no longer
- dnl works, so we have to add it manually.
- LIBS="$LIBS -lpthread"
AC_DEFINE(ACE_HAS_PTHREADS)
],
[
- ace_has_pthreads=yes
+ ACE_CHECK_LIB(pthread, pthread_create, pthread.h, dnl
+ [
+ ace_has_pthreads=yes
+ dnl Since we AC_DEFINE(ACE_HAS_PTHREADS), the default behavior
+ dnl of adding "-lpthread" to the "LIBS" variable no longer
+ dnl works, so we have to add it manually.
+ LIBS="$LIBS -lpthread"
+ AC_DEFINE(ACE_HAS_PTHREADS)
+ ],
+ [
+ ace_has_pthreads=yes
+ ])
])
- ])
- ],
- [
- ACE_SEARCH_LIBS(pthread_create, pthread pthreads c_r gthreads,
- [
- ace_has_pthreads=yes
- AC_DEFINE(ACE_HAS_PTHREADS)
],
[
ace_has_pthreads=no
])
])
-
dnl If we don't have any thread library, then disable threading altogether!
if test "$ace_has_pthreads" != yes &&
test "$ace_has_sthreads" != yes; then
@@ -172,26 +166,26 @@ thr_create();
AC_TRY_CPP(
[
#include <pthread.h>
- ],
- [
- cat > conftest.$ac_ext <<EOF
+ ], ace_header_exists=yes, ace_header_exists=no)
+
+ cat > conftest.$ac_ext <<EOF
#include <pthread.h>
ACE_REAL_FUNCTION pthread_create
EOF
- if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "ACE_REAL_FUNCTION" |
- (eval "$AWK '{print \[$]2}' > conftest.awk 2>&1"); then
- rm -f conftest.$ac_ext
- ace_real_function=`cat conftest.awk`
- rm -f conftest.awk
- fi
- ],
- [
- ace_real_function="pthread_create"
- ])
+ if test "$ace_header_exists" = yes; then
+ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "ACE_REAL_FUNCTION" |
+ (eval "$AWK '{print \[$]2}' > conftest.awk 2>&1"); then
+ rm -f conftest.$ac_ext
+ ace_real_function=`cat conftest.awk`
+ rm -f conftest.awk
+ fi
+ else
+ ace_real_function="pthread_create"
+ fi dnl test "$ace_header_not_exist" != yes
AC_TRY_LINK(
[