diff -rU 10 site/config/ompi_check_pthread_pids.m4 p3/config/ompi_check_pthread_pids.m4 --- site/config/ompi_check_pthread_pids.m4 2006-11-09 19:53:59.000000000 +0100 +++ p3/config/ompi_check_pthread_pids.m4 2007-09-27 09:07:43.000000000 +0200 @@ -26,62 +26,65 @@ # OMPI_THREADS_HAVE_DIFFERENT_PIDS (variable) # # Test for Linux-like threads in the system. We will need to handle things like # getpid() differently in the case of a Linux-like threads model. # AH_TEMPLATE([OMPI_THREADS_HAVE_DIFFERENT_PIDS], [Do threads have different pids (pthreads on linux)]) AC_MSG_CHECKING([if threads have different pids (pthreads on linux)]) +CFLAGS_save="$CFLAGS" +CFLAGS="$CFLAGS $THREAD_CFLAGS" CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS" LDFLAGS_save="$LDFLAGS" LDFLAGS="$LDFLAGS $THREAD_LDFLAGS" LIBS_save="$LIBS" LIBS="$LIBS $THREAD_LIBS" AC_TRY_RUN([#include #include #include #include void *checkpid(void *arg); int main() { pthread_t thr; - int pid, retval; + int pid, *retval; pid = getpid(); pthread_create(&thr, NULL, checkpid, &pid); pthread_join(thr, (void **) &retval); - exit(retval); + exit(*retval); } +static int ret; void *checkpid(void *arg) { - int ret; int ppid = *((int *) arg); if (ppid == getpid()) ret = 0; else ret = 1; - pthread_exit((void *) ret); + pthread_exit((void *) &ret); }], [MSG=no OMPI_THREADS_HAVE_DIFFERENT_PIDS=0], [MSG=yes OMPI_THREADS_HAVE_DIFFERENT_PIDS=1], [case $host in *-linux*) MSG="cross compiling - assuming yes" OMPI_THREADS_HAVE_DIFFERENT_PIDS=1 ;; *) MSG="cross compiling - assuming no" OMPI_THREADS_HAVE_DIFFERENT_PIDS=0 ;; esac ]) +CFLAGS="$CFLAGS_save" CPPFLAGS="$CPPFLAGS_save" LDFLAGS="$LDFLAGS_save" LIBS="$LIBS_save" AC_MSG_RESULT([$MSG]) AC_DEFINE_UNQUOTED(OMPI_THREADS_HAVE_DIFFERENT_PIDS, $OMPI_THREADS_HAVE_DIFFERENT_PIDS) # # if pthreads is not available, then the system does not have an insane threads # model