diff options
author | Steve Huston <shuston@riverace.com> | 2004-11-30 22:33:31 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2004-11-30 22:33:31 +0000 |
commit | 3e6e402dcbe185c3f9129ea27af8b26f27942182 (patch) | |
tree | 396bafe7ba0c7069cf144401a8ffbea174bc6390 | |
parent | 9fad611bd788c79e54d1584591faf10820834786 (diff) | |
download | ATCD-3e6e402dcbe185c3f9129ea27af8b26f27942182.tar.gz |
ChangeLogTag:Tue Nov 30 17:32:29 2004 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | m4/ace.m4 | 49 | ||||
-rw-r--r-- | m4/threads.m4 | 109 |
3 files changed, 129 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog index 09a7d9abc75..fa8d38dc867 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Tue Nov 30 17:32:29 2004 Steve Huston <shuston@riverace.com> + + * m4/ace.m4: Added two new options, --enable-pthreads and + --enable-uithreads. These en/dis-able the use of Pthreads and + UI Threads (aka Solaris threads), respectively. Some platforms + (namely AIX) offer a hokey UI Threads that barely functions but + can't be used for any real work. Efforts to detect this and + automatically disable it have been unfruitful, so this option was + added. Pthreads defaults to yes, UI threads defaults to, except on + Solaris where it defaults to yes. + + * m4/threads.m4: Only do Pthreads/UIthreads checks if the corresponding + implementation is enabled by the command line (or default) using + the above new options. + Tue Nov 30 07:32:18 2004 Chad Elliott <elliott_c@ociweb.com> * apps/gperf/tests/iout2_gen/.empty: diff --git a/m4/ace.m4 b/m4/ace.m4 index 0aa25c31734..49b6e67cb3d 100644 --- a/m4/ace.m4 +++ b/m4/ace.m4 @@ -316,6 +316,55 @@ AC_DEFUN([ACE_CONFIGURATION_OPTIONS], ]) AM_CONDITIONAL([BUILD_THREADS], [test X$ace_user_enable_threads = Xyes]) + AC_ARG_ENABLE([pthreads], + AS_HELP_STRING(--enable-pthreads,enable POSIX thread (Pthreads) support [[[yes]]]), + [ + case "${enableval}" in + yes) + ace_user_enable_pthreads=yes + ;; + no) + ace_user_enable_pthreads=no + ;; + *) + AC_MSG_ERROR([bad value ${enableval} for --enable-pthreads]) + ;; + esac + ], + [ + ace_user_enable_pthreads=yes + ]) + + AC_ARG_ENABLE([uithreads], + AS_HELP_STRING(--enable-uithreads,enable UNIX International thread support [[[no]]]), + [ + case "${enableval}" in + yes) + ace_user_enable_uithreads=yes + ;; + no) + ace_user_enable_uithreads=no + ;; + *) + AC_MSG_ERROR([bad value ${enableval} for --enable-uithreads]) + ;; + esac + ], + [ + dnl The default is to disable UI threads. However, on Solaris, we + dnl enable it by default since it's functionality is very useful and + dnl has traditionally been enabled in ACE. + case "$host" in + *solaris2*) + ace_user_enable_uithreads=yes + AC_MSG_NOTICE([[--enable-uithreads enabled by default for Solaris; use --enable-uithreads=no to disable it.]]) + ;; + *) + ace_user_enable_uithreads=no + ;; + esac + ]) + AC_ARG_ENABLE([verb-not-sup], AS_HELP_STRING(--enable-verb-not-sup,enable verbose ENOTSUP reports [[[no]]]), [ diff --git a/m4/threads.m4 b/m4/threads.m4 index bfffd5ac02a..d6fc759b4c1 100644 --- a/m4/threads.m4 +++ b/m4/threads.m4 @@ -67,60 +67,70 @@ dnl AC_REQUIRE([AC_LANG]) dnl Do nothing ]) - dnl Check for UNIX International Threads -- STHREADS - AC_SEARCH_LIBS([thr_create], [thread], - [ - ace_has_sthreads=yes - AC_DEFINE([ACE_HAS_STHREADS], 1, - [Define to 1 if platform has UNIX International Threads]) - ], - [ - ace_has_sthreads=no - ]) - - dnl Sometimes thr_create is actually found with explicitly linking against - dnl -lthread, so try a more "exotic" function. - AC_SEARCH_LIBS([rwlock_destroy], [thread],[],[]) + dnl Check for UNIX International Threads (ACE calls this STHREADS) + dnl This used to check for thr_create(), but AIX has a semi-functional + dnl UI Threads capability that includes thr_create(). We don't want to + dnl find such a half-hearted UI Threads, so this was changed to look for + dnl a UI Threads function that AIX doesn't offer. + AS_IF([test "$ace_user_enable_uithreads" = yes], + [ AC_MSG_CHECKING([for UNIX International threads capability]) + AC_SEARCH_LIBS([mutex_lock], [thread], + [ + ace_has_sthreads=yes + AC_DEFINE([ACE_HAS_STHREADS], 1, + [Define to 1 if platform has UNIX International Threads]) + ], + [ + ace_has_sthreads=no + ]) + dnl Sometimes thr_create is actually found with explicitly linking against + dnl -lthread, so try a more "exotic" function. + AC_SEARCH_LIBS([rwlock_destroy], [thread],[],[]) + AC_MSG_RESULT([$ace_has_sthreads]) + ],[]) dnl Check if any thread related preprocessor flags are needed. ACE_CHECK_THREAD_CPPFLAGS dnl Check for POSIX threads ace_has_pthreads=no - - AC_MSG_CHECKING([for POSIX threads library]) - - ACE_CHECK_POSIX_THREADS( - [ - ace_has_pthreads=yes - AC_DEFINE([ACE_HAS_PTHREADS], 1, - [Define to 1 if platform has POSIX threads]) - AC_MSG_RESULT([none required]) - ], - []) - - AS_IF([test "$ace_has_pthreads" != yes], - [ - ace_posix_threads_search_LIBS="$LIBS" - for ace_p in pthread pthreads c_r gthreads; do - LIBS="-l$ace_p $ace_posix_threads_search_LIBS" - ACE_CHECK_POSIX_THREADS( - [ + AS_IF([test "$ace_user_enable_pthreads" = yes], + [ AC_MSG_CHECKING([for POSIX threads library]) + ACE_CHECK_POSIX_THREADS( + [ ace_has_pthreads=yes - AC_DEFINE([ACE_HAS_PTHREADS]) - AC_MSG_RESULT([-l$ace_p]) - break + AC_DEFINE([ACE_HAS_PTHREADS], 1, + [Define to 1 if platform has POSIX threads]) + AC_MSG_RESULT([none required]) + ], + []) + + AS_IF([test "$ace_has_pthreads" != yes], + [ + ace_posix_threads_search_LIBS="$LIBS" + for ace_p in pthread pthreads c_r gthreads; do + LIBS="-l$ace_p $ace_posix_threads_search_LIBS" + ACE_CHECK_POSIX_THREADS( + [ + ace_has_pthreads=yes + AC_DEFINE([ACE_HAS_PTHREADS]) + AC_MSG_RESULT([-l$ace_p]) + break + ], + []) + done + + AS_IF([test "$ace_has_pthreads" != yes], + [ + AC_MSG_RESULT([no]) + LIBS="$ace_posix_threads_search_LIBS" + ],[]) ], []) - done - - AS_IF([test "$ace_has_pthreads" != yes], - [ - AC_MSG_RESULT([no]) - LIBS="$ace_posix_threads_search_LIBS" - ],[]) ], - []) + [ + AC_MSG_NOTICE([Pthreads disabled by user; not checking for it]) + ]) dnl If we don't have any thread library, then disable threading altogether! AS_IF([test "$ace_has_pthreads" != yes && test "$ace_has_sthreads" != yes], @@ -143,13 +153,24 @@ AC_DEFUN([ACE_CHECK_THREAD_FLAGS], dnl to get around this nuisance by checking the return value of dnl thr_create(). The cross-compiled case will use a link-time dnl test, instead. + dnl Furthermore, we need the implementation to be a real one, not + dnl a half-hearted attempt such as that provided on AIX 5. So, we + dnl make sure it can at least work with a mutex. AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <thread.h> +#if ((THR_BOUND & THR_SUSPEND & THR_DETACHED) != 0) +# error This is a silly UI Threads implementation. +#endif extern "C" void * ace_start_func (void *) { + mutex_t m; + mutex_init (&m, USYNC_THREAD, NULL); + mutex_lock (&m); + mutex_unlock (&m); + mutex_destroy (&m); return 0; } |