diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2003-11-04 09:05:39 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2003-11-04 09:05:39 +0000 |
commit | d1cfb7cbac9c4384da40a367e25f0dacf3676ca1 (patch) | |
tree | 8fe6122031ec5181f1a08c4b57ae5a186b3c0f89 /m4 | |
parent | 6c9b87900011ee56da23b0972f2ec809fad2f481 (diff) | |
download | ATCD-d1cfb7cbac9c4384da40a367e25f0dacf3676ca1.tar.gz |
ChangeLogTag:Tue Nov 4 01:03:56 2003 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ace.m4 | 40 | ||||
-rw-r--r-- | m4/acinclude.m4 | 13 | ||||
-rw-r--r-- | m4/compiler.m4 | 14 | ||||
-rw-r--r-- | m4/config_h.m4 | 7 | ||||
-rw-r--r-- | m4/features.m4 | 70 | ||||
-rw-r--r-- | m4/subsets.m4 | 6 | ||||
-rw-r--r-- | m4/threads.m4 | 231 |
7 files changed, 162 insertions, 219 deletions
diff --git a/m4/ace.m4 b/m4/ace.m4 index a81d40370dc..57768d31b90 100644 --- a/m4/ace.m4 +++ b/m4/ace.m4 @@ -1,11 +1,11 @@ dnl ------------------------------------------------------------------------- dnl $Id$ -dnl +dnl dnl ace.m4 dnl dnl ACE M4 include file which contains ACE specific M4 macros dnl for enabling/disabling certain ACE features. -dnl +dnl dnl ------------------------------------------------------------------------- dnl Copyright (C) 1998, 1999, 2000, 2002 Ossama Othman @@ -14,7 +14,7 @@ dnl All Rights Reserved dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the current ACE distribution terms. -dnl +dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -204,15 +204,17 @@ AC_DEFUN([ACE_CONFIGURATION_OPTIONS], AC_PATH_XTRA dnl Here, if X isn't found or the user sets "--without-x" on the command dnl line, then "no_x" is set to "yes." - if test "$no_x" != yes; then - ACE_XLIBS="-lX11 -lXt" - ace_user_enable_xt_reactor=yes - else - ACE_XLIBS="" - ace_user_enable_xt_reactor=no - AC_MSG_WARN([X was not found or it was disabled.]) - AC_MSG_WARN([ACE_XtReactor will not be enabled.]) - fi + AS_IF([test "$no_x" != yes], + [ + ACE_XLIBS="-lX11 -lXt" + ace_user_enable_xt_reactor=yes + ], + [ + ACE_XLIBS="" + ace_user_enable_xt_reactor=no + AC_MSG_WARN([X was not found or it was disabled.]) + AC_MSG_WARN([ACE_XtReactor will not be enabled.]) + ]) ;; no) ACE_XLIBS="" @@ -249,10 +251,11 @@ dnl line, then "no_x" is set to "yes." yes) ace_user_with_gperf=yes AC_DEFINE([ACE_HAS_GPERF]) - if test -n "$GPERF"; then - AC_MSG_WARN([gperf program already exists]) - AC_MSG_WARN([existing gperf may be overwritten during installation]) - fi + AS_IF([test -n "$GPERF"], + [ + AC_MSG_WARN([gperf program already exists]) + AC_MSG_WARN([existing gperf may be overwritten during installation]) + ],[]) ;; no) ace_user_with_gperf=no @@ -265,10 +268,11 @@ dnl line, then "no_x" is set to "yes." [ ace_user_with_gperf=yes AC_DEFINE([ACE_HAS_GPERF]) - if test -n "$GPERF"; then + AS_IF([test -n "$GPERF"], + [ AC_MSG_WARN([gperf program already exists]) AC_MSG_WARN([existing gperf may be overwritten during installation]) - fi + ],[]) ]) AM_CONDITIONAL([COMPILE_GPERF], [test X$ace_user_with_gperf = Xyes]) diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 index cd045366c4d..603acb910cc 100644 --- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -1,12 +1,12 @@ dnl ------------------------------------------------------------------------- dnl $Id$ -dnl +dnl dnl ACE M4 include file which contains general M4 macros dnl to be used by the ACE configure script. dnl dnl The macros in this file were designed for ACE but should be dnl general enough for general use. -dnl +dnl dnl ------------------------------------------------------------------------- dnl Copyright (C) 1998, 1999, 2000, 2002 Ossama Othman @@ -15,7 +15,7 @@ dnl All Rights Reserved dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the current ACE distribution terms. -dnl +dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -347,7 +347,7 @@ EOF fi if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "ACE_REAL_FUNCTION" | + $EGREP "ACE_REAL_FUNCTION" | (eval "$AWK '{print \[$]2}' > conftest.awk 2>&1"); then rm -f conftest.$ac_ext ace_real_function=`cat conftest.awk` @@ -439,7 +439,7 @@ dnl enum. If it is an enum, determine the enum type. sed -e 's/^.*setrlimit.*(.*enum//' -e 's/[^ ]*,.*$//'` changequote([, ])dnl - ace_setrlimit_enum="enum $ace_setrlimit_enum" + ace_setrlimit_enum="enum $ace_setrlimit_enum" AC_MSG_RESULT([$ace_setrlimit_enum]) @@ -482,7 +482,7 @@ dnl enum. If it is an enum, determine the enum type. sed -e 's/^.*getrusage.*(.*enum//' -e 's/[^ ]*,.*$//'` changequote([, ])dnl - ace_rusage_who="enum $ace_rusage_who" + ace_rusage_who="enum $ace_rusage_who" AC_MSG_RESULT([$ace_rusage_who]) @@ -786,4 +786,3 @@ dnl if test $ac_cv_sys_restartable_syscalls = yes; then dnl AC_DEFINE([HAVE_RESTARTABLE_SYSCALLS]) dnl fi dnl ]) - diff --git a/m4/compiler.m4 b/m4/compiler.m4 index ffcdff48e68..b7ac6fdcb3f 100644 --- a/m4/compiler.m4 +++ b/m4/compiler.m4 @@ -1,11 +1,11 @@ dnl ------------------------------------------------------------------------- dnl $Id$ -dnl +dnl dnl compiler.m4 dnl dnl ACE M4 include file which contains ACE specific M4 macros dnl that set/determine compiler configurations for ACE. -dnl +dnl dnl ------------------------------------------------------------------------- dnl Copyright (C) 1998, 1999, 2003 Ossama Othman @@ -14,7 +14,7 @@ dnl All Rights Reserved dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the current ACE distribution terms. -dnl +dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -27,7 +27,7 @@ dnl ACE_SET_COMPILER_FLAGS dnl Usage: ACE_SET_COMPILER_FLAGS AC_DEFUN([ACE_SET_COMPILER_FLAGS], [ -dnl AC_BEFORE([$0], [AM_PROG_LIBTOOL]) +dnl AC_BEFORE([$0], [AC_PROG_LIBTOOL]) dnl Make sure we know what C++ compiler and preprocessor we have! AC_REQUIRE([AC_PROG_CXX]) @@ -171,7 +171,7 @@ changequote([, ])dnl *freebsd*) case "$CXX" in *) - if test "$GXX" = yes; then + if test "$GXX" = yes; then CXXFLAGS="$CXXFLAGS" ACE_CXXFLAGS="$ACE_CXXFLAGS -w -fno-strict-prototypes" DCXXFLAGS="" @@ -231,7 +231,7 @@ changequote([, ])dnl # If exception support is explicitly disabled, tell the # compiler. This is not recommended since the run-time - # library can throw exceptions. + # library can throw exceptions. if test "$ace_user_enable_exceptions" != yes; then ACE_CXXFLAGS="$ACE_CXXFLAGS +noeh" fi @@ -308,7 +308,7 @@ changequote([, ])dnl CXXFLAGS="$CXXFLAGS -features=castop" if test "$ace_user_enable_rtti" = yes; then CXXFLAGS="$CXXFLAGS -features=rtti" - fi + fi fi dnl Sun C++ 5.0 weirdness diff --git a/m4/config_h.m4 b/m4/config_h.m4 index 6350f076c0e..5a2d6800e69 100644 --- a/m4/config_h.m4 +++ b/m4/config_h.m4 @@ -27,8 +27,6 @@ AC_DEFUN([ACE_PREP_CONFIG_HEADER], [ dnl Text to be placed at the top of the `ace/config.h' header. AH_TOP([ -// -*- C++ -*- - #ifndef ACE_CONFIG_H #define ACE_CONFIG_H @@ -42,6 +40,11 @@ AH_BOTTOM([ #endif /* ACE_CONFIG_H */ + + +// Local Variables: +// mode:C++ +// End: ]) diff --git a/m4/features.m4 b/m4/features.m4 index 1b1b91e806d..98aaf93989c 100644 --- a/m4/features.m4 +++ b/m4/features.m4 @@ -1,11 +1,11 @@ dnl ------------------------------------------------------------------------- dnl $Id$ -dnl +dnl dnl features.m4 dnl dnl ACE M4 include file which contains ACE specific M4 macros dnl that determine availablility of certain OS features for ACE. -dnl +dnl dnl ------------------------------------------------------------------------- dnl Copyright (C) 1998, 1999, 2002 Ossama Othman @@ -14,7 +14,7 @@ dnl All Rights Reserved dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the current ACE distribution terms. -dnl +dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -187,7 +187,7 @@ Test_Aio::do_aio (void) // the completion for the first one. if (aio_read (this->aiocb_read_) < 0) perror ("aio_read"); - + // Wait for the completion on aio_suspend. struct aiocb *list_aiocb[2]; list_aiocb [0] = this->aiocb_write_; @@ -247,7 +247,7 @@ Test_Aio::do_aio (void) //cout << "Both the AIO operations done." << endl; //cout << "The buffer is :" << this->buffer_read_ << endl; - + return 0; } @@ -262,11 +262,11 @@ main () // "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"); return -1; } - + if (test_aio.do_aio () != 0) { //printf ("AIOCB test failed:\n" - // "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"); + // "ACE_POSIX_AIOCB_PROACTOR may not work in this platform\n"); return -1; } //printf ("AIOCB test successful:\n" @@ -326,7 +326,7 @@ int test_aio_calls (void); int setup_signal_handler (void); int setup_signal_handler (int signal_number); -int +int setup_signal_delivery (void) { // Make the sigset_t consisting of the completion signal. @@ -335,20 +335,20 @@ setup_signal_delivery (void) perror ("Error:Couldn't init the RT completion signal set\n"); return -1; } - + if (sigaddset (&completion_signal, SIGRTMIN) == -1) { perror ("Error:Couldn't init the RT completion signal set\n"); return -1; } - + // Mask them. if (pthread_sigmask (SIG_BLOCK, &completion_signal, 0) == -1) { perror ("Error:Couldn't make the RT completion signals\n"); return -1; } - + return setup_signal_handler (SIGRTMIN); } @@ -363,8 +363,8 @@ issue_aio_calls (void) aiocb1.aio_reqprio = 0; aiocb1.aio_sigevent.sigev_notify = SIGEV_SIGNAL; aiocb1.aio_sigevent.sigev_signo = SIGRTMIN; - aiocb1.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb1; - + aiocb1.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb1; + // Fire off the aio write. if (aio_read (&aiocb1) == -1) { @@ -372,7 +372,7 @@ issue_aio_calls (void) perror ("Error:Asynch_Read_Stream: aio_read queueing failed\n"); return -1; } - + // Setup AIOCB. aiocb2.aio_fildes = file_handle; aiocb2.aio_offset = BUFSIZ + 1; @@ -381,8 +381,8 @@ issue_aio_calls (void) aiocb2.aio_reqprio = 0; aiocb2.aio_sigevent.sigev_notify = SIGEV_SIGNAL; aiocb2.aio_sigevent.sigev_signo = SIGRTMIN; - aiocb2.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb2; - + aiocb2.aio_sigevent.sigev_value.sival_ptr = (void *) &aiocb2; + // Fire off the aio write. if (aio_read (&aiocb2) == -1) { @@ -407,15 +407,15 @@ query_aio_completions (void) timespec timeout; timeout.tv_sec = 5; timeout.tv_nsec = 0; - + // To get back the signal info. siginfo_t sig_info; - + // Await the RT completion signal. int sig_return = sigtimedwait (&completion_signal, &sig_info, &timeout); - + // Error case. // If failure is coz of timeout, then return *0* but set // errno appropriately. This is what the WinNT proactor @@ -425,7 +425,7 @@ query_aio_completions (void) perror ("Error:Error waiting for RT completion signals\n"); return -1; } - + // RT completion signals returned. if (sig_return != SIGRTMIN) { @@ -433,11 +433,11 @@ query_aio_completions (void) // sig_return); return -1; } - + // @@ Debugging. //printf ("Sig number found in the sig_info block : %d\n", // sig_info.si_signo); - + // Is the signo returned consistent? if (sig_info.si_signo != sig_return) { @@ -445,11 +445,11 @@ query_aio_completions (void) // sig_info.si_signo); return -1; } - + // @@ Debugging. //printf ("Signal code for this signal delivery : %d\n", // sig_info.si_code); - + // Is the signal code an aio completion one? if ((sig_info.si_code != SI_ASYNCIO) && (sig_info.si_code != SI_QUEUE)) @@ -458,10 +458,10 @@ query_aio_completions (void) // sig_info.si_code); return -1; } - + // Retrive the aiocb. aiocb* aiocb_ptr = (aiocb *) sig_info.si_value.sival_ptr; - + // Analyze error and return values. Return values are // actually <errno>'s associated with the <aio_> call // corresponding to aiocb_ptr. @@ -471,7 +471,7 @@ query_aio_completions (void) perror ("Error:Invalid control block was sent to <aio_error> for compleion querying\n"); return -1; } - + if (error_code != 0) { // Error occurred in the <aio_>call. Return the errno @@ -488,7 +488,7 @@ query_aio_completions (void) perror ("Error:Invalid control block was sent to <aio_return>\n"); return -1; } - + //if (number_of_completions == 0) // Print the buffer. //printf ("Number of bytes transferred : %d\n The buffer : %s \n", @@ -504,26 +504,26 @@ query_aio_completions (void) } int -test_aio_calls (void) +test_aio_calls (void) { // Set up the input file. // Open file (in SEQUENTIAL_SCAN mode) file_handle = open ("test_aiosig.txt", O_RDONLY); - + if (file_handle == -1) { perror ("open"); return -1; } - + unlink ("test_aiosig.txt"); // Unlink now so we don't have to do so later. if (setup_signal_delivery () < 0) return -1; - + if (issue_aio_calls () < 0) return -1; - + if (query_aio_completions () < 0) return -1; @@ -546,7 +546,7 @@ setup_signal_handler (int signal_number) #if defined (SA_SIGACTION) // Lynx says, it is better to set this bit to be portable. reaction.sa_flags &= SA_SIGACTION; -#endif /* SA_SIGACTION */ +#endif /* SA_SIGACTION */ reaction.sa_sigaction = null_handler; // Null handler. int sigaction_return = sigaction (SIGRTMIN, &reaction, @@ -556,7 +556,7 @@ setup_signal_handler (int signal_number) perror ("Error:Proactor couldn't do sigaction for the RT SIGNAL"); return -1; } - + return 0; } diff --git a/m4/subsets.m4 b/m4/subsets.m4 index 69a6fe5274e..9ec654be377 100644 --- a/m4/subsets.m4 +++ b/m4/subsets.m4 @@ -1,11 +1,11 @@ dnl ------------------------------------------------------------------------- dnl $Id$ -dnl +dnl dnl subsets.m4 dnl dnl ACE M4 include file which contains ACE specific M4 macros dnl that set/determine which ACE subsets to build. -dnl +dnl dnl ------------------------------------------------------------------------- dnl Copyright (C) 1998, 1999, 2001 Ossama Othman @@ -14,7 +14,7 @@ dnl All Rights Reserved dnl dnl This library is free software; you can redistribute it and/or dnl modify it under the current ACE distribution terms. -dnl +dnl dnl This library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/m4/threads.m4 b/m4/threads.m4 index 56f2fe394e9..f6cd6cba36d 100644 --- a/m4/threads.m4 +++ b/m4/threads.m4 @@ -35,7 +35,7 @@ dnl AC_LANG([C++]) dnl AC_REQUIRE([AC_LANG]) dnl Check if compiler accepts specific flag to enable threads - ACE_CACHE_CHECK([if compiler may need a thread flag], + ACE_CACHE_CHECK([if compiler may need a command line thread flag], [ace_cv_feature_may_need_thread_flag], [ ace_save_CXXFLAGS="$CXXFLAGS" @@ -85,114 +85,46 @@ dnl AC_REQUIRE([AC_LANG]) ACE_CHECK_THREAD_CPPFLAGS 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], - [ - dnl Add thread preprocessor flags, if any. - ace_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$ACE_THR_CPPFLAGS $CPPFLAGS" dnl User's CPPFLAGS go last + ace_has_pthreads=no - AC_EGREP_CPP([ACE_PTHREAD_MACROS], - [ -#include <pthread.h> + AC_MSG_CHECKING([for POSIX threads library]) -#if defined (pthread_create) - ACE_PTHREAD_MACROS -#endif - ], - [ - ace_cv_lib_pthread_compat_macros=yes - ], - [ - ace_cv_lib_pthread_compat_macros=no - ]) - - dnl Reset the preprocessor flags - CPPFLAGS="$ace_save_CPPFLAGS" - ], + ACE_CHECK_POSIX_THREADS( [ - 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], - [ - 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_has_pthreads=yes + AC_DEFINE([ACE_HAS_PTHREADS]) + AC_MSG_RESULT([none required]) ], + []) + + AS_IF([test "$ace_has_pthreads" != yes], [ - AC_SEARCH_LIBS([pthread_create], [pthread pthreads c_r gthreads], - [ - ace_has_pthreads=yes - AC_DEFINE([ACE_HAS_PTHREADS]) - - dnl This is ugly but some platforms appear to implement stubs - dnl in the C library, so it is possible that a no-op function - dnl may be found. Here we check for a few more functions in - dnl case this is so. This may not be fool proof since the - dnl additional functions themselves may be implemented as - dnl stubs, in which case the same problem will occur! - dnl Another solution is to check for the function using - dnl AC_CHECK_LIB but that will force the library to be added - dnl to the LIBS variable, which may not even be necessary. In - dnl any case, it may be the better solution. If problems arise - dnl in the future regarding this issue, then we should probably - dnl switch to doing an AC_CHECK_LIB before each AC_SEARCH_LIBS - dnl below. - - dnl Search for functions in more recent standards first. - - dnl Note that the functions were chosen since they appear to be - dnl more "exotic" than the less "interesting" functions such as - dnl pthread_mutexattr_init. - - dnl Draft 7 and Standard - AC_SEARCH_LIBS([pthread_setschedparam], - [pthread pthreads c_r gthreads],, - [ - dnl Draft 6 - AC_SEARCH_LIBS([pthread_attr_setprio], - [pthread pthreads c_r gthreads],, - [ - dnl Draft 4 - AC_SEARCH_LIBS([pthread_setprio], - [pthread pthreads c_r gthreads],,) - ]) - ]) - ], - [ - ace_has_pthreads=no - ]) - ]) + 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" + ],[]) + ], + []) 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 + AS_IF([test "$ace_has_pthreads" != yes && test "$ace_has_sthreads" != yes], + [ ace_user_enable_threads=no - fi + ]) ]) dnl This macro will check that the current compiler flags do something @@ -200,8 +132,6 @@ dnl useful in terms of thread libraries and/or functions. dnl Usage: ACE_CHECK_THREAD_FLAGS(ACTION-IF-USABLE [, ACTION-IF-NOT-USABLE]]) AC_DEFUN([ACE_CHECK_THREAD_FLAGS], [ - AC_REQUIRE([AC_PROG_AWK]) - ACE_CONVERT_WARNINGS_TO_ERRORS([ dnl Check for UI thread support first. @@ -232,52 +162,8 @@ main () [$1], [ dnl Now check for POSIX thread support. + ACE_CHECK_POSIX_THREADS([$1],[$2]) - dnl Because some platforms are brain damaged enough to provide - dnl useless thread function stubs, link tests may succeed despite the - dnl fact the stubs are no-ops. This forces us to use a run-time test - dnl to get around this nuisance by checking the return value of - dnl pthread_create(). The cross-compiled case will use a link-time - dnl test, instead. - AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include <pthread.h> - -extern "C" void * -ace_start_func (void *) -{ - return 0; -} - -int -main () -{ - pthread_t tid = 0; - - return pthread_create (&tid, 0, ace_start_func, 0); -} - ]])], - [$1], - [$2], - [ - dnl POSIX threads cross-compiled case - - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#include <pthread.h> - -extern "C" void * -ace_start_func (void *) -{ - return 0; -} - ]], - [[ - pthread_t tid = 0; - - (void) pthread_create (&tid, 0, ace_start_func, 0); - ]])], - [$1], - [$2]) - ]) ], [ dnl UI threads cross-compiled case @@ -372,3 +258,54 @@ THROW ME AN ERROR! ACE_THR_CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE" ]) ]) + +dnl Check for POSIX threads support. +dnl Usage: ACE_CHECK_POSIX_THREADS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +AC_DEFUN([ACE_CHECK_POSIX_THREADS], +[ + dnl Because some platforms are brain damaged enough to provide + dnl useless thread function stubs, link tests may succeed despite the + dnl fact the stubs are no-ops. This forces us to use a run-time test + dnl to get around this nuisance by checking the return value of + dnl pthread_create(). The cross-compiled case will use a link-time + dnl test, instead. + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <pthread.h> + +extern "C" void * +ace_start_func (void *) +{ + return 0; +} + +int +main () +{ + pthread_t tid = 0; + + return pthread_create (&tid, 0, ace_start_func, 0); +} + ]])], + [$1], + [$2], + [ + dnl POSIX threads check -- cross-compiled case + + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include <pthread.h> + +extern "C" void * +ace_start_func (void *) +{ + return 0; +} + ]], + [[ + pthread_t tid = 0; + + (void) pthread_create (&tid, 0, ace_start_func, 0); + ]])], + [$1], + [$2]) + ]) +]) |