1
1
openmpi/config/ompi_check_pthread_pids.m4
Brian Barrett 17d2c907fc Some changes to better support cross-compiling OMPI:
- fall back to compile test for windows paffinity component
    when cross compiling
  - fall back to platform guess when checking for threads having
    different pids with pthreads (yes on linux, no elsewhere)
  - pass the proper host, target, and build flags to the
    ROMIO configure script

With these changes, cross-compiling should be possible with the exception
of the Fortran 77 and Fortran 90 bindings.  Fortran 77 can be cross-
compiled if cache values are provided for type sizes and alignment.

This commit was SVN r8702.
2006-01-16 04:00:44 +00:00

90 строки
2.4 KiB
Plaintext

dnl
dnl Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
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.
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
define(OMPI_CHECK_PTHREAD_PIDS,[
#
# Arguments: none
#
# Dependencies: None
#
# Sets:
# 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)])
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);
int main(int argc, char* argv[]) {
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);
}],
[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
])
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
#
unset MSG])dnl