2004-01-14 10:06:57 +03:00
|
|
|
dnl
|
2006-01-16 07:00:44 +03:00
|
|
|
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
2005-11-05 22:57:48 +03:00
|
|
|
dnl University Research and Technology
|
|
|
|
dnl Corporation. All rights reserved.
|
|
|
|
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
dnl of Tennessee Research Foundation. All rights
|
|
|
|
dnl reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
dnl University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
dnl Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
dnl All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
2004-01-14 10:06:57 +03:00
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
define(OMPI_CHECK_PTHREAD_PIDS,[
|
2004-01-14 10:06:57 +03:00
|
|
|
#
|
|
|
|
# Arguments: none
|
|
|
|
#
|
|
|
|
# Dependencies: None
|
|
|
|
#
|
|
|
|
# Sets:
|
2004-06-07 19:33:53 +04:00
|
|
|
# OMPI_THREADS_HAVE_DIFFERENT_PIDS (variable)
|
2004-01-14 10:06:57 +03:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AH_TEMPLATE([OMPI_THREADS_HAVE_DIFFERENT_PIDS],
|
2004-01-14 10:06:57 +03:00
|
|
|
[Do threads have different pids (pthreads on linux)])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([if threads have different pids (pthreads on linux)])
|
|
|
|
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 <pthread.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
void *checkpid(void *arg);
|
2006-09-23 03:58:23 +04:00
|
|
|
int main() {
|
2004-01-14 10:06:57 +03:00
|
|
|
pthread_t thr;
|
|
|
|
int pid, retval;
|
|
|
|
pid = getpid();
|
|
|
|
pthread_create(&thr, NULL, checkpid, &pid);
|
|
|
|
pthread_join(thr, (void **) &retval);
|
|
|
|
exit(retval);
|
|
|
|
}
|
|
|
|
void *checkpid(void *arg) {
|
|
|
|
int ret;
|
|
|
|
int ppid = *((int *) arg);
|
|
|
|
if (ppid == getpid())
|
|
|
|
ret = 0;
|
|
|
|
else
|
|
|
|
ret = 1;
|
|
|
|
pthread_exit((void *) ret);
|
|
|
|
}],
|
2004-06-07 19:33:53 +04:00
|
|
|
[MSG=no OMPI_THREADS_HAVE_DIFFERENT_PIDS=0],
|
2006-01-16 07:00:44 +03:00
|
|
|
[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
|
|
|
|
])
|
2004-01-14 10:06:57 +03:00
|
|
|
|
|
|
|
CPPFLAGS="$CPPFLAGS_save"
|
|
|
|
LDFLAGS="$LDFLAGS_save"
|
|
|
|
LIBS="$LIBS_save"
|
|
|
|
|
|
|
|
AC_MSG_RESULT([$MSG])
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OMPI_THREADS_HAVE_DIFFERENT_PIDS, $OMPI_THREADS_HAVE_DIFFERENT_PIDS)
|
2004-01-14 10:06:57 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# if pthreads is not available, then the system does not have an insane threads
|
|
|
|
# model
|
|
|
|
#
|
|
|
|
unset MSG])dnl
|