First cut at thread support / eliminate warnings due to lack of
LAM_HAVE_THREADS This commit was SVN r364.
Этот коммит содержится в:
родитель
3e6822b8ac
Коммит
eda594df84
@ -29,6 +29,7 @@ sinclude(config/lam_setup_cxx.m4)
|
||||
sinclude(config/lam_setup_f77.m4)
|
||||
sinclude(config/lam_setup_f90.m4)
|
||||
|
||||
#
|
||||
# Contributed tests
|
||||
#
|
||||
sinclude(config/lam_check_pthread_pids.m4)
|
||||
sinclude(config/lam_config_pthreads.m4)
|
||||
sinclude(config/lam_config_solaris_threads.m4)
|
||||
sinclude(config/lam_config_threads.m4)
|
||||
|
@ -14,8 +14,12 @@ EXTRA_DIST = \
|
||||
f77_find_ext_symbol_convention.m4 \
|
||||
lam_case_sensitive_fs_setup.m4 \
|
||||
lam_check_optflags.m4 \
|
||||
lam_check_pthread_pids.m4 \
|
||||
lam_config_subdir.m4 \
|
||||
lam_config_subdir_args.m4 \
|
||||
lam_config_pthreads.m4 \
|
||||
lam_config_solaris_threads.m4 \
|
||||
lam_config_threads.m4 \
|
||||
lam_configure_options.m4 \
|
||||
lam_functions.m4 \
|
||||
lam_get_version.m4 \
|
||||
|
64
config/lam_check_pthread_pids.m4
Обычный файл
64
config/lam_check_pthread_pids.m4
Обычный файл
@ -0,0 +1,64 @@
|
||||
dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
|
||||
define(LAM_CHECK_PTHREAD_PIDS,[
|
||||
#
|
||||
# Arguments: none
|
||||
#
|
||||
# Dependencies: None
|
||||
#
|
||||
# Sets:
|
||||
# LAM_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([LAM_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 LAM_THREADS_HAVE_DIFFERENT_PIDS=0],
|
||||
[MSG=yes LAM_THREADS_HAVE_DIFFERENT_PIDS=1])
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_save"
|
||||
LDFLAGS="$LDFLAGS_save"
|
||||
LIBS="$LIBS_save"
|
||||
|
||||
AC_MSG_RESULT([$MSG])
|
||||
AC_DEFINE_UNQUOTED(LAM_THREADS_HAVE_DIFFERENT_PIDS, $LAM_THREADS_HAVE_DIFFERENT_PIDS)
|
||||
|
||||
#
|
||||
# if pthreads is not available, then the system does not have an insane threads
|
||||
# model
|
||||
#
|
||||
unset MSG])dnl
|
629
config/lam_config_pthreads.m4
Обычный файл
629
config/lam_config_pthreads.m4
Обычный файл
@ -0,0 +1,629 @@
|
||||
dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
dnl LAM_CONFIG_POSIX_THREADS()
|
||||
dnl
|
||||
dnl Configure posix threads, setting the following variables (but
|
||||
dnl not calling AC_SUBST on them).
|
||||
|
||||
# ********************************************************************
|
||||
#
|
||||
# Internal macros - do not call from outside LAM_CONFIG_POSIX_THREADS
|
||||
#
|
||||
# ********************************************************************
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_PTHREAD_TRY_LINK], [
|
||||
# BEGIN: LAM_INTL_PTHREAD_TRY_LINK
|
||||
#
|
||||
# Make sure that we can run a small application in C or C++, which
|
||||
# ever is the current language. Do make sure that C or C++ is the
|
||||
# current language.
|
||||
AC_TRY_LINK([#include <pthread.h>],
|
||||
[pthread_t th; pthread_join(th, 0);
|
||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
||||
[$1], [$2])
|
||||
# END: LAM_INTL_PTHREAD_TRY_LINK
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_PTHREAD_TRY_LINK_F77], [
|
||||
# BEGIN: LAM_INTL_PTHREAD_TRY_LINK_F77
|
||||
#
|
||||
# Make sure that we can run a small application in Fortran, with
|
||||
# pthreads living in a C object file
|
||||
|
||||
# Fortran module
|
||||
cat > conftestf.f <<EOF
|
||||
program fpthread
|
||||
INTEGER i
|
||||
i = 1
|
||||
end
|
||||
EOF
|
||||
|
||||
# C module
|
||||
if test -f conftest.h; then
|
||||
lam_conftest_h="#include \"conftest.h\""
|
||||
else
|
||||
lam_conftest_h=""
|
||||
fi
|
||||
cat > conftest.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
$lam_conftest_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void lam_pthread()
|
||||
{
|
||||
pthread_t th;
|
||||
pthread_join(th, 0);
|
||||
pthread_attr_init(0);
|
||||
pthread_cleanup_push(0, 0);
|
||||
pthread_create(0,0,0,0);
|
||||
pthread_cleanup_pop(0);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
EOF
|
||||
|
||||
# Try the compile
|
||||
LAM_LOG_COMMAND(
|
||||
[$CC $CFLAGS -I. -c conftest.c],
|
||||
LAM_LOG_COMMAND(
|
||||
[$F77 $FFLAGS conftestf.f conftest.o -o conftest $LIBS],
|
||||
[HAPPY=1],
|
||||
[HAPPY=0]),
|
||||
[HAPPY=0])
|
||||
|
||||
if test "$HAPPY" = "1"; then
|
||||
$1
|
||||
else
|
||||
LAM_LOG_MSG([here is the C program:], 1)
|
||||
LAM_LOG_FILE([conftest.c])
|
||||
if test -f conftest.h; then
|
||||
LAM_LOG_MSG([here is contest.h:], 1)
|
||||
LAM_LOG_FILE([conftest.h])
|
||||
fi
|
||||
LAM_LOG_MSG([here is the fortran program:], 1)
|
||||
LAM_LOG_FILE([conftestf.f])
|
||||
$2
|
||||
fi
|
||||
|
||||
unset HAPPY lam_conftest_h
|
||||
/bin/rm -f conftest*
|
||||
# END: LAM_INTL_PTHREAD_TRY_LINK_F77
|
||||
])dnl
|
||||
|
||||
|
||||
# ********************************************************************
|
||||
#
|
||||
# Try to compile thread support without any special flags
|
||||
#
|
||||
# ********************************************************************
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_PLAIN_C], [
|
||||
#
|
||||
# C compiler
|
||||
#
|
||||
if test "$lam_pthread_c_success" = "0"; then
|
||||
AC_MSG_CHECKING([if C compiler and POSIX threads work as is])
|
||||
if test "$HAVE_POSIX_THREADS" = "1" ; then
|
||||
run_this_test=1
|
||||
else
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*solaris*)
|
||||
AC_MSG_RESULT([no - Solaris, not checked])
|
||||
run_this_test=0
|
||||
;;
|
||||
*-aix* | *-freebsd*)
|
||||
if test "`echo $CPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then
|
||||
PTRHEAD_CPPFLAGS="-D_THREAD_SAFE"
|
||||
CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS"
|
||||
fi
|
||||
run_this_test=1
|
||||
;;
|
||||
*)
|
||||
if test "`echo $CPPFLAGS | grep 'D_REENTRANT'`" = ""; then
|
||||
PTHREAD_CPPFLAGS="-D_REENTRANT"
|
||||
CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS"
|
||||
fi
|
||||
run_this_test=1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "$run_this_test" = "1" ; then
|
||||
AC_LANG_PUSH(C)
|
||||
LAM_INTL_PTHREAD_TRY_LINK(lam_pthread_c_success=1,
|
||||
lam_pthread_c_success=0)
|
||||
AC_LANG_POP(C)
|
||||
if test "$lam_pthread_c_success" = "1"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
PTHREAD_CPPFLAGS=
|
||||
CPPFLAGS="$orig_CPPFLAGS"
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_PLAIN_CXX], [
|
||||
#
|
||||
# C++ compiler
|
||||
#
|
||||
if test "$lam_pthread_cxx_success" = "0"; then
|
||||
AC_MSG_CHECKING([if C++ compiler and POSIX threads work as is])
|
||||
if test "$HAVE_POSIX_THREADS" = "1" ; then
|
||||
run_this_test=1
|
||||
else
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*solaris*)
|
||||
AC_MSG_RESULT([no - Solaris, not checked])
|
||||
run_this_test=0
|
||||
;;
|
||||
*-aix* | *-freebsd*)
|
||||
if test "`echo $CXXCPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then
|
||||
PTRHEAD_CXXCPPFLAGS="-D_THREAD_SAFE"
|
||||
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
|
||||
fi
|
||||
run_this_test=1
|
||||
;;
|
||||
*)
|
||||
if test "`echo $CXXCPPFLAGS | grep 'D_REENTRANT'`" = ""; then
|
||||
PTHREAD_CXXCPPFLAGS="-D_REENTRANT"
|
||||
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
|
||||
fi
|
||||
run_this_test=1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "$run_this_test" = "1" ; then
|
||||
AC_LANG_PUSH(C++)
|
||||
LAM_INTL_PTHREAD_TRY_LINK(lam_pthread_cxx_success=1,
|
||||
lam_pthread_cxx_success=0)
|
||||
AC_LANG_POP(C++)
|
||||
if test "$lam_pthread_cxx_success" = "1"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
PTHREAD_CXXCPPFLAGS=
|
||||
CXXCPPFLAGS="$orig_CXXCPPFLAGS"
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_PLAIN_FC], [
|
||||
#
|
||||
# Fortran compiler
|
||||
#
|
||||
if test "$lam_pthread_f77_success" = "0" -a "$LAM_WANT_FORTRAN" = "1"; then
|
||||
AC_MSG_CHECKING([if F77 compiler and POSIX threads work as is])
|
||||
if test "$HAVE_POSIX_THREADS" = "1" ; then
|
||||
run_this_test=1
|
||||
else
|
||||
case "${host_cpu}-${host_os}" in
|
||||
*solaris*)
|
||||
AC_MSG_RESULT([no - Solaris, not checked])
|
||||
run_this_test=0
|
||||
;;
|
||||
*)
|
||||
run_this_test=1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "$run_this_test" = "1" ; then
|
||||
AC_LANG_PUSH(C)
|
||||
LAM_INTL_PTHREAD_TRY_LINK_F77(lam_pthread_f77_success=1,
|
||||
lam_pthread_f77_success=0)
|
||||
AC_LANG_POP(C)
|
||||
if test "$lam_pthread_f77_success" = "1"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_PLAIN], [
|
||||
# BEGIN: LAM_INTL_POSIX_THREADS_PLAIN
|
||||
#
|
||||
# Check if can compile without any special flags
|
||||
# we throw -D_REENTRANT or -D_THREAD_SAFE in here, just in
|
||||
# case. Some systems (OS X, for example) generally don't need
|
||||
# the defines, but then will on one system header here or there
|
||||
# why take chances?
|
||||
#
|
||||
|
||||
# Only run C++ and Fortran if those compilers already configured
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[LAM_INTL_POSIX_THREADS_PLAIN_C],
|
||||
[lam_pthread_c_success=1])
|
||||
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[LAM_INTL_POSIX_THREADS_PLAIN_CXX],
|
||||
[lam_pthread_cxx_success=1])
|
||||
|
||||
AC_PROVIDE_IFELSE([LAM_PROG_F77],
|
||||
[LAM_INTL_POSIX_THREADS_PLAIN_FC],
|
||||
[lam_pthread_f77_success=1])
|
||||
|
||||
# End: LAM_INTL_POSIX_THREADS_PLAIN
|
||||
])dnl
|
||||
|
||||
|
||||
# ********************************************************************
|
||||
#
|
||||
# Try to compile thread support with special compiler flags
|
||||
#
|
||||
# ********************************************************************
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS_C], [
|
||||
#
|
||||
# C compiler
|
||||
#
|
||||
if test "$lam_pthread_c_success" = "0"; then
|
||||
for pf in $pflags; do
|
||||
AC_MSG_CHECKING([if C compiler and POSIX threads work with $pf])
|
||||
CFLAGS="$orig_CFLAGS $pf"
|
||||
AC_LANG_PUSH(C)
|
||||
LAM_INTL_PTHREAD_TRY_LINK(lam_pthread_c_success=1,
|
||||
lam_pthread_c_success=0)
|
||||
AC_LANG_POP(C)
|
||||
if test "$lam_pthread_c_success" = "1"; then
|
||||
PTHREAD_CFLAGS="$pf"
|
||||
AC_MSG_RESULT([yes])
|
||||
break
|
||||
else
|
||||
PTHREAD_CFLAGS=
|
||||
CFLAGS="$orig_CFLAGS"
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS_CXX], [
|
||||
#
|
||||
# C++ compiler
|
||||
#
|
||||
if test "$lam_pthread_cxx_success" = "0"; then
|
||||
for pf in $pflags; do
|
||||
AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $pf])
|
||||
CXXFLAGS="$orig_CXXFLAGS $pf"
|
||||
AC_LANG_PUSH(C++)
|
||||
LAM_INTL_PTHREAD_TRY_LINK(lam_pthread_cxx_success=1,
|
||||
lam_pthread_cxx_success=0)
|
||||
AC_LANG_POP(C++)
|
||||
if test "$lam_pthread_cxx_success" = "1"; then
|
||||
PTHREAD_CXXFLAGS="$pf"
|
||||
AC_MSG_RESULT([yes])
|
||||
break
|
||||
else
|
||||
PTHREAD_CXXFLAGS=
|
||||
CXXFLAGS="$orig_CXXFLAGS"
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS_FC], [
|
||||
#
|
||||
# Fortran compiler
|
||||
#
|
||||
if test "$lam_pthread_f77_success" = "0" -a "$LAM_WANT_FORTRAN" = "1"; then
|
||||
for pf in $pflags; do
|
||||
AC_MSG_CHECKING([if F77 compiler and POSIX threads work with $pf])
|
||||
FFLAGS="$orig_FFLAGS $pf"
|
||||
AC_LANG_PUSH(C)
|
||||
LAM_INTL_PTHREAD_TRY_LINK_F77(lam_pthread_f77_success=1,
|
||||
lam_pthread_f77_success=0)
|
||||
AC_LANG_POP(C)
|
||||
if test "$lam_pthread_f77_success" = "1"; then
|
||||
PTHREAD_FFLAGS="$pf"
|
||||
AC_MSG_RESULT([yes])
|
||||
break
|
||||
else
|
||||
PTHREAD_FFLAGS=
|
||||
FFLAGS="$orig_FFLAGS"
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS],[
|
||||
# Begin: LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS
|
||||
#
|
||||
# If above didn't work, try some super-special compiler flags
|
||||
# that get evaluated to the "right" things.
|
||||
#
|
||||
# -Kthread:
|
||||
# -kthread: FreeBSD kernel threads
|
||||
# -pthread: Modern GCC (most all platforms)
|
||||
# -pthreads: GCC on solaris
|
||||
# -mthreads:
|
||||
# -mt: Solaris native compilers / HP-UX aCC
|
||||
#
|
||||
# Put -mt before -mthreads because HP-UX aCC will properly compile
|
||||
# with -mthreads (reading as -mt), but emit a warning about unknown
|
||||
# flags hreads. Stupid compilers.
|
||||
pflags="-Kthread -kthread -pthread -pthreads -mt -mthreads"
|
||||
|
||||
# Only run C++ and Fortran if those compilers already configured
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS_C],
|
||||
[lam_pthread_c_success=1])
|
||||
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS_CXX],
|
||||
[lam_pthread_cxx_success=1])
|
||||
|
||||
AC_PROVIDE_IFELSE([LAM_PROG_F77],
|
||||
[LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS_FC],
|
||||
[lam_pthread_f77_success=1])
|
||||
|
||||
# End: LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS
|
||||
])dnl
|
||||
|
||||
|
||||
# ********************************************************************
|
||||
#
|
||||
# Try to compile thread support with extra libs
|
||||
#
|
||||
# ********************************************************************
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_LIBS_C],[
|
||||
#
|
||||
# C compiler
|
||||
#
|
||||
if test "$lam_pthread_c_success" = "0"; then
|
||||
for pl in $plibs; do
|
||||
AC_MSG_CHECKING([if C compiler and POSIX threads work with $pl])
|
||||
case "${host_cpu}-${host-_os}" in
|
||||
*-aix* | *-freebsd*)
|
||||
if test "`echo $CPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then
|
||||
PTRHEAD_CPPFLAGS="-D_THREAD_SAFE"
|
||||
CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if test "`echo $CPPFLAGS | grep 'D_REENTRANT'`" = ""; then
|
||||
PTHREAD_CPPFLAGS="-D_REENTRANT"
|
||||
CPPFLAGS="$CPPFLAGS $PTHREAD_CPPFLAGS"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
LIBS="$orig_LIBS $pl"
|
||||
AC_LANG_PUSH(C)
|
||||
LAM_INTL_PTHREAD_TRY_LINK(lam_pthread_c_success=1,
|
||||
lam_pthread_c_success=0)
|
||||
AC_LANG_POP(C)
|
||||
if test "$lam_pthread_c_success" = "1"; then
|
||||
PTHREAD_LIBS="$pl"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
PTHREAD_CPPFLAGS=
|
||||
CPPFLAGS="$orig_CPPFLAGS"
|
||||
LIBS="$orig_LIBS"
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_LIBS_CXX],[
|
||||
#
|
||||
# C++ compiler
|
||||
#
|
||||
if test "$lam_pthread_cxx_success" = "0"; then
|
||||
if test ! "$lam_pthread_c_success" = "0" -a ! "$PTHREAD_LIBS" = "" ; then
|
||||
AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $PTHREAD_LIBS])
|
||||
case "${host_cpu}-${host-_os}" in
|
||||
*-aix* | *-freebsd*)
|
||||
if test "`echo $CXXCPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then
|
||||
PTRHEAD_CXXCPPFLAGS="-D_THREAD_SAFE"
|
||||
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if test "`echo $CXXCPPFLAGS | grep 'D_REENTRANT'`" = ""; then
|
||||
PTHREAD_CXXCPPFLAGS="-D_REENTRANT"
|
||||
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
LIBS="$orig_LIBS $PTHREAD_LIBS"
|
||||
AC_LANG_PUSH(C++)
|
||||
LAM_INTL_PTHREAD_TRY_LINK(lam_pthread_cxx_success=1,
|
||||
lam_pthread_cxx_success=0)
|
||||
AC_LANG_POP(C++)
|
||||
if test "$lam_pthread_cxx_success" = "1"; then
|
||||
PTHREAD_LIBS="$pl"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
CXXCPPFLAGS="$orig_CXXCPPFLAGS"
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can not find working threads configuration. aborting])
|
||||
fi
|
||||
else
|
||||
for pl in $plibs; do
|
||||
AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $pl])
|
||||
case "${host_cpu}-${host-_os}" in
|
||||
*-aix* | *-freebsd*)
|
||||
if test "`echo $CXXCPPFLAGS | grep 'D_THREAD_SAFE'`" = ""; then
|
||||
PTRHEAD_CXXCPPFLAGS="-D_THREAD_SAFE"
|
||||
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if test "`echo $CXXCPPFLAGS | grep 'D_REENTRANT'`" = ""; then
|
||||
PTHREAD_CXXCPPFLAGS="-D_REENTRANT"
|
||||
CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
LIBS="$orig_LIBS $pl"
|
||||
AC_LANG_PUSH(C++)
|
||||
LAM_INTL_PTHREAD_TRY_LINK(lam_pthread_cxx_success=1,
|
||||
lam_pthread_cxx_success=0)
|
||||
AC_LANG_POP(C++)
|
||||
if test "$lam_pthread_cxx_success" = "1"; then
|
||||
PTHREAD_LIBS="$pl"
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
PTHREAD_CXXCPPFLAGS=
|
||||
CXXCPPFLAGS="$orig_CXXCPPFLAGS"
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_LIBS_FC],[
|
||||
#
|
||||
# Fortran compiler
|
||||
#
|
||||
if test "$lam_pthread_f77_success" = "0" -a "$LAM_WANT_FORTRAN" = "1"; then
|
||||
if test ! "$lam_pthread_c_success" = "0" -a ! "$PTHREAD_LIBS" = "" ; then
|
||||
AC_MSG_CHECKING([if F77 compiler and POSIX threads work with $PTHREAD_LIBS])
|
||||
LIBS="$orig_LIBS $PTHREAD_LIBS"
|
||||
AC_LANG_PUSH(C)
|
||||
LAM_INTL_PTHREAD_TRY_LINK_F77(lam_pthread_f77_success=1,
|
||||
lam_pthread_f77_success=0)
|
||||
AC_LANG_POP(C)
|
||||
LIBS="$orig_LIBS"
|
||||
if test "$lam_pthread_f77_success" = "1"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can not find working threads configuration. aborting])
|
||||
fi
|
||||
else
|
||||
for pl in $plibs; do
|
||||
AC_MSG_CHECKING([if F77 compiler and POSIX threads work with $pl])
|
||||
LIBS="$orig_LIBS $pl"
|
||||
AC_LANG_PUSH(C)
|
||||
LAM_INTL_PTHREAD_TRY_LINK_F77(lam_pthread_f77_success=1,
|
||||
lam_pthread_f77_success=0)
|
||||
AC_LANG_POP(C)
|
||||
LIBS="$orig_LIBS"
|
||||
if test "$lam_pthread_f77_success" = "1"; then
|
||||
PTHREAD_LIBS="$pl"
|
||||
AC_MSG_RESULT([yes])
|
||||
break
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_POSIX_THREADS_LIBS],[
|
||||
# Begin: LAM_INTL_POSIX_THREADS_LIBS
|
||||
#
|
||||
# if we can't find a super-special compiler flags, try some libraries.
|
||||
# we throw -D_REENTRANT or -D_THREAD_SAFE in here, just in case. Some
|
||||
# systems (OS X, for example) generally don't need the defines, but
|
||||
# then will on one system header here or there why take chances?
|
||||
#
|
||||
# libpthreads: AIX - must check before libpthread
|
||||
# liblthread: LinuxThreads on FreeBSD
|
||||
# libpthread: The usual place (like we can define usual!)
|
||||
plibs="-lpthreads -llthread -lpthread"
|
||||
|
||||
# Only run C++ and Fortran if those compilers already configured
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[LAM_INTL_POSIX_THREADS_LIBS_C],
|
||||
[lam_pthread_c_success=1])
|
||||
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[LAM_INTL_POSIX_THREADS_LIBS_CXX],
|
||||
[lam_pthread_cxx_success=1])
|
||||
|
||||
AC_PROVIDE_IFELSE([LAM_PROG_F77],
|
||||
[LAM_INTL_POSIX_THREADS_LIBS_FC],
|
||||
[lam_pthread_f77_success=1])
|
||||
|
||||
# End: LAM_INTL_POSIX_THREADS_LIBS]
|
||||
)dnl
|
||||
|
||||
|
||||
#********************************************************************
|
||||
#
|
||||
# External macro (aka, the real thing)
|
||||
#
|
||||
#********************************************************************
|
||||
AC_DEFUN(LAM_CONFIG_POSIX_THREADS,[
|
||||
lam_pthread_c_success=0
|
||||
lam_pthread_f77_success=0
|
||||
lam_pthread_cxx_success=0
|
||||
|
||||
orig_CFLAGS="$CFLAGS"
|
||||
orig_FFLAGS="$FFLAGS"
|
||||
orig_CXXFLAGS="$CXXFLAGS"
|
||||
orig_CPPFLAGS="$CPPFLAGS"
|
||||
orig_CXXCPPFLAGS="$CXXCPPFLAGS"
|
||||
orig_LDFLAGS="$LDFLAGS"
|
||||
orig_LIBS="$LIBS"
|
||||
|
||||
PTRHEAD_CFLAGS=
|
||||
PTHREAD_FFLAGS=
|
||||
PTHREAD_CXXFLAGS=
|
||||
PTHREAD_CPPFLAGS=
|
||||
PTHREAD_CXXCPPFLAGS=
|
||||
PTHREAD_LDFLAGS=
|
||||
PTHREAD_LIBS=
|
||||
|
||||
# Try with the basics, mam.
|
||||
LAM_INTL_POSIX_THREADS_PLAIN
|
||||
|
||||
# Try the super-special compiler flags.
|
||||
LAM_INTL_POSIX_THREADS_SPECIAL_FLAGS
|
||||
|
||||
# Try the normal linking methods (that's no fun)
|
||||
LAM_INTL_POSIX_THREADS_LIBS
|
||||
|
||||
CFLAGS="$orig_CFLAGS"
|
||||
FFLAGS="$orig_FFLAGS"
|
||||
CXXFLAGS="$orig_CXXFLAGS"
|
||||
CPPFLAGS="$orig_CPPFLAGS"
|
||||
CXXCPPFLAGS="$orig_CXXCPPFLAGS"
|
||||
LDFLAGS="$orig_LDFLAGS"
|
||||
LIBS="$orig_LIBS"
|
||||
|
||||
if test "$LAM_WANT_FORTRAN" != "1"; then
|
||||
lam_pthread_f77_success=1
|
||||
fi
|
||||
|
||||
if test "$lam_pthread_c_success" = "1" -a \
|
||||
"$lam_pthread_cxx_success" = "1" -a \
|
||||
"$lam_pthread_f77_success" = "1"; then
|
||||
internal_useless=1
|
||||
$1
|
||||
else
|
||||
internal_useless=1
|
||||
$2
|
||||
fi
|
||||
|
||||
unset lam_pthread_c_success lam_pthread_f77_success lam_pthread_cxx_success
|
||||
unset internal_useless
|
||||
])dnl
|
236
config/lam_config_solaris_threads.m4
Обычный файл
236
config/lam_config_solaris_threads.m4
Обычный файл
@ -0,0 +1,236 @@
|
||||
dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
dnl LAM_CONFIG_SOLARIS_THREADS()
|
||||
dnl
|
||||
|
||||
# ********************************************************************
|
||||
#
|
||||
# Internal macros - do not call from outside LAM_CONFIG_SOLARIS_THREADS
|
||||
#
|
||||
# ********************************************************************
|
||||
|
||||
AC_DEFUN([LAM_INTL_SOLARIS_TRY_LINK], [
|
||||
# BEGIN: LAM_INTL_SOLARIS_TRY_LINK
|
||||
#
|
||||
# Make sure that we can run a small application in C or C++, which
|
||||
# ever is the current language. Do make sure that C or C++ is the
|
||||
# current language.
|
||||
AC_TRY_LINK([#include <thread.h>],
|
||||
[thread_t th; thr_join(th, 0, 0);
|
||||
thr_create(0,0,0,0,0,0); ],
|
||||
[$1], [$2])
|
||||
# END: LAM_INTL_SOLARIS_TRY_LINK
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_INTL_SOLARIS_TRY_LINK_F77], [
|
||||
# BEGIN: LAM_INTL_SOLARIS_TRY_LINK_F77
|
||||
#
|
||||
# Make sure that we can run a small application in Fortran, with
|
||||
# pthreads living in a C object file
|
||||
|
||||
# Fortran module
|
||||
cat > conftestf.f <<EOF
|
||||
program fpthread
|
||||
INTEGER i
|
||||
i = 1
|
||||
end
|
||||
EOF
|
||||
|
||||
# C module
|
||||
if test -f conftest.h; then
|
||||
lam_conftest_h="#include \"conftest.h\""
|
||||
else
|
||||
lam_conftest_h=""
|
||||
fi
|
||||
cat > conftest.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <thread.h>
|
||||
$lam_conftest_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void lam_pthread()
|
||||
{
|
||||
thread_t th;
|
||||
thr_join(th, 0, 0);
|
||||
thr_create(0,0,0,0,0,0);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
EOF
|
||||
|
||||
# Try the compile
|
||||
LAM_LOG_COMMAND(
|
||||
[$CC $CFLAGS -I. -c conftest.c],
|
||||
LAM_LOG_COMMAND(
|
||||
[$F77 $FFLAGS conftestf.f conftest.o -o conftest $LIBS],
|
||||
[HAPPY=1],
|
||||
[HAPPY=0]),
|
||||
[HAPPY=0])
|
||||
|
||||
if test "$HAPPY" = "1"; then
|
||||
$1
|
||||
else
|
||||
LAM_LOG_MSG([here is the C program:], 1)
|
||||
LAM_LOG_FILE([conftest.c])
|
||||
if test -f conftest.h; then
|
||||
LAM_LOG_MSG([here is contest.h:], 1)
|
||||
LAM_LOG_FILE([conftest.h])
|
||||
fi
|
||||
LAM_LOG_MSG([here is the fortran program:], 1)
|
||||
LAM_LOG_FILE([conftestf.f])
|
||||
$2
|
||||
fi
|
||||
|
||||
unset HAPPY lam_conftest_h
|
||||
/bin/rm -f conftest*
|
||||
# END: LAM_INTL_SOLARIS_TRY_LINK_F77
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_CONFIG_SOLARIS_THREADS_C], [
|
||||
if test "$BASECC" = "cc"; then
|
||||
STHREAD_CFLAGS="-mt"
|
||||
style="Workshop/Forte"
|
||||
else
|
||||
STHREAD_CPPFLAGS="-D_REENTRANT"
|
||||
STHREAD_LIBS="-lthread"
|
||||
style="-lthread"
|
||||
fi
|
||||
AC_MSG_CHECKING([if C compiler and Solaris threads work])
|
||||
CFLAGS="$STHREAD_CFLAGS $CFLAGS_orig"
|
||||
CPPFLAGS="$STHREAD_CPPFLAGS $CPPFLAGS_orig"
|
||||
LDFLAGS="$STHREAD_LDFLAGS $LDFLAGS_orig"
|
||||
LIBS="$STHREAD_LIBS $LIBS_orig"
|
||||
AC_LANG_PUSH(C)
|
||||
LAM_INTL_SOLARIS_TRY_LINK(lam_sthread_c_success=1,
|
||||
lam_sthread_c_success=0)
|
||||
AC_LANG_POP(C)
|
||||
if test "$lam_sthread_c_success" = "1"; then
|
||||
AC_MSG_RESULT([yes - $style])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_CONFIG_SOLARIS_THREADS_CXX], [
|
||||
if test "$BASECXX" = "CC"; then
|
||||
STHREAD_CXXFLAGS="-mt"
|
||||
style="Workshop/Forte"
|
||||
elif test "$BASECXX" = "KCC"; then
|
||||
STHREAD_CXXFLAGS="--backend -mt"
|
||||
style="KCC"
|
||||
else
|
||||
STHREAD_CXXCPPFLAGS="-D_REENTRANT"
|
||||
STHREAD_LIBS="-lthread"
|
||||
style="-lthread"
|
||||
fi
|
||||
CXXFLAGS="$STHREAD_CXXFLAGS $CXXFLAGS_orig"
|
||||
CXXCPPFLAGS="$STHREAD_CXXPPFLAGS $CXXPPFLAGS_orig"
|
||||
LDFLAGS="$STHREAD_LDFLAGS $LDFLAGS_orig"
|
||||
LIBS="$STHREAD_LIBS $LIBS_orig"
|
||||
AC_MSG_CHECKING([if C++ compiler and Solaris threads work])
|
||||
AC_LANG_PUSH(C++)
|
||||
LAM_INTL_SOLARIS_TRY_LINK(lam_sthread_cxx_success=1,
|
||||
lam_sthread_cxx_success=0)
|
||||
AC_LANG_POP(C++)
|
||||
if test "$lam_sthread_cxx_success" = "1"; then
|
||||
AC_MSG_RESULT([yes - $style])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_CONFIG_SOLARIS_THREADS_FC], [
|
||||
if test "$LAM_WANT_FORTRAN" = "1"; then
|
||||
if test "$BASEFC" = "f77"; then
|
||||
STHREAD_FFLAGS="-mt"
|
||||
style="Workshop/Forte"
|
||||
else
|
||||
STHREAD_LIBS="-lthread"
|
||||
style="-lthread"
|
||||
fi
|
||||
FFLAGS="$STHREAD_FFLAGS $FFLAGS_orig"
|
||||
CFLAGS="$STHREAD_CFLAGS $CFLAGS_orig"
|
||||
CPPFLAGS="$STHREAD_CPPFLAGS $CPPFLAGS_orig"
|
||||
LDFLAGS="$STHREAD_LDFLAGS $LDFLAGS_orig"
|
||||
LIBS="$STHREAD_LIBS $LIBS_orig"
|
||||
AC_MSG_CHECKING([if F77 compiler and Solaris threads work])
|
||||
AC_LANG_PUSH(C)
|
||||
LAM_INTL_SOLARIS_TRY_LINK_F77(lam_sthread_f77_success=1,
|
||||
lam_sthread_f77_success=0)
|
||||
AC_LANG_POP(C)
|
||||
if test "$lam_sthread_f77_success" = "1"; then
|
||||
AC_MSG_RESULT([yes - $style])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
else
|
||||
lam_sthread_f77_success=1
|
||||
fi
|
||||
])dnl
|
||||
|
||||
|
||||
AC_DEFUN([LAM_CONFIG_SOLARIS_THREADS],[
|
||||
lam_sthread_c_success=0
|
||||
lam_sthread_f77_success=0
|
||||
lam_sthread_cxx_success=0
|
||||
|
||||
orig_CFLAGS="$CFLAGS"
|
||||
orig_FFLAGS="$FFLAGS"
|
||||
orig_CXXFLAGS="$CXXFLAGS"
|
||||
orig_CPPFLAGS="$CPPFLAGS"
|
||||
orig_CXXCPPFLAGS="$CXXCPPFLAGS"
|
||||
orig_LDFLAGS="$LDFLAGS"
|
||||
orig_LIBS="$LIBS"
|
||||
|
||||
STHREAD_CFLAGS=
|
||||
STHREAD_FFLAGS=
|
||||
STHREAD_CXXFLAGS=
|
||||
STHREAD_CPPFLAGS=
|
||||
STHREAD_CXXCPPFLAGS=
|
||||
STHREAD_LDFLAGS=
|
||||
STHREAD_LIBS=
|
||||
|
||||
# Only run C++ and Fortran if those compilers already configured
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[LAM_CONFIG_SOLARIS_THREADS_C],
|
||||
[lam_sthread_c_success=1])
|
||||
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[LAM_CONFIG_SOLARIS_THREADS_CXX],
|
||||
[lam_sthread_cxx_success=1])
|
||||
|
||||
AC_PROVIDE_IFELSE([LAM_PROG_F77],
|
||||
[LAM_CONFIG_SOLARIS_THREADS_FC],
|
||||
[lam_sthread_f77_success=1])
|
||||
|
||||
CFLAGS="$orig_CFLAGS"
|
||||
FFLAGS="$orig_FFLAGS"
|
||||
CXXFLAGS="$orig_CXXFLAGS"
|
||||
CPPFLAGS="$orig_CPPFLAGS"
|
||||
CXXCPPFLAGS="$orig_CXXCPPFLAGS"
|
||||
LDFLAGS="$orig_LDFLAGS"
|
||||
LIBS="$orig_LIBS"
|
||||
|
||||
if test "$lam_sthread_c_success" = "1" -a \
|
||||
"$lam_sthread_cxx_success" = "1" -a \
|
||||
"$lam_sthread_f77_success" = "1"; then
|
||||
internal_useless=1
|
||||
$1
|
||||
else
|
||||
internal_useless=1
|
||||
$2
|
||||
fi
|
||||
|
||||
unset lam_sthread_c_success lam_sthread_f77_success lam_sthread_cxx_success
|
||||
unset internal_useless
|
||||
])dnl
|
||||
|
162
config/lam_config_threads.m4
Обычный файл
162
config/lam_config_threads.m4
Обычный файл
@ -0,0 +1,162 @@
|
||||
dnl
|
||||
dnl $HEADER$
|
||||
dnl
|
||||
|
||||
AC_DEFUN(LAM_CONFIG_THREADS,[
|
||||
#
|
||||
# Arguments: none
|
||||
#
|
||||
# Dependencies: None
|
||||
#
|
||||
# Modifies:
|
||||
# none - see called tests
|
||||
#
|
||||
# configure threads
|
||||
#
|
||||
|
||||
# create templates
|
||||
AH_TEMPLATE([LAM_HAVE_SOLARIS_THREADS],
|
||||
[Do we have native Solaris threads])
|
||||
AH_TEMPLATE([LAM_HAVE_POSIX_THREADS],
|
||||
[Do we have POSIX threads])
|
||||
|
||||
#
|
||||
# Check for thread types - add your type here...
|
||||
#
|
||||
LAM_CONFIG_POSIX_THREADS(HAVE_POSIX_THREADS=1, HAVE_POSIX_THREADS=0)
|
||||
AC_MSG_CHECKING([for working POSIX threads package])
|
||||
if test "$HAVE_POSIX_THREADS" = "1" ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
export HAVE_POSIX_THREADS
|
||||
|
||||
LAM_CONFIG_SOLARIS_THREADS(HAVE_SOLARIS_THREADS=1, HAVE_SOLARIS_THREADS=0)
|
||||
AC_MSG_CHECKING([for working Solaris threads package])
|
||||
if test "$HAVE_SOLARIS_THREADS" = "1" ; then
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
export HAVE_SOLARIS_THREADS
|
||||
|
||||
#
|
||||
# Ask what threading we want (allow solaris / pthread right now)
|
||||
#
|
||||
AC_MSG_CHECKING([for type of thread support])
|
||||
AC_ARG_WITH(threads,
|
||||
AC_HELP_STRING([--with-threads],
|
||||
[Set thread type (solaris / pthread)]),
|
||||
[THREAD_TYPE=$withval])
|
||||
|
||||
if test "$THREAD_TYPE" = "solaris"; then
|
||||
|
||||
if test "$HAVE_SOLARIS_THREADS" = "0"; then
|
||||
AC_MSG_WARN(["*** You have chosen Solaris threads, which are not"])
|
||||
AC_MSG_WARN(["*** available on your system "])
|
||||
AC_MSG_ERROR(["*** Can not continue"])
|
||||
fi
|
||||
elif test "$THREAD_TYPE" = "posix"; then
|
||||
|
||||
if test "$HAVE_POSIX_THREADS" = "0"; then
|
||||
AC_MSG_WARN(["*** You have chosen POSIX threads, which are not"])
|
||||
AC_MSG_WARN(["*** available on your system "])
|
||||
AC_MSG_ERROR(["*** Can not continue"])
|
||||
fi
|
||||
elif test "$THREAD_TYPE" = "no"; then
|
||||
THREAD_TYPE="none"
|
||||
elif test "$THREAD_TYPE" = ""; then
|
||||
|
||||
# Actual logic here - properly set THREAD_TYPE - we go for system
|
||||
# optimized where ever possible
|
||||
case "$host" in
|
||||
*solaris*)
|
||||
if test "$HAVE_SOLARIS_THREADS" = "1"; then
|
||||
THREAD_TYPE="solaris"
|
||||
elif test "$HAVE_POSIX_THREADS" = "1"; then
|
||||
THREAD_TYPE="posix"
|
||||
else
|
||||
THEAD_TYPE="none found"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if test "$HAVE_POSIX_THREADS" = "1"; then
|
||||
THREAD_TYPE="posix"
|
||||
else
|
||||
THREAD_TYPE="none found"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
AC_MSG_WARN(["*** You have specified a thread type that I do not"])
|
||||
AC_MSG_WARN(["*** understand. Valid options are posix and solaris"])
|
||||
AC_MSG_ERROR(["*** Can not continue."])
|
||||
fi
|
||||
AC_MSG_RESULT($THREAD_TYPE)
|
||||
|
||||
|
||||
#
|
||||
# Ok, now run the configuration for that thread package.
|
||||
#
|
||||
# Blah - this should be made better, but I don't know how...
|
||||
#
|
||||
if test "$THREAD_TYPE" = "solaris"; then
|
||||
AC_DEFINE(LAM_HAVE_SOLARIS_THREADS, 1)
|
||||
AC_DEFINE(LAM_HAVE_POSIX_THREADS, 0)
|
||||
AC_DEFINE(LAM_THREADS_HAVE_DIFFERENT_PIDS, 0)
|
||||
|
||||
THREAD_CFLAGS="$STHREAD_CFLAGS"
|
||||
THREAD_FFLAGS="$STHREAD_FFLAGS"
|
||||
THREAD_CXXFLAGS="$STHREAD_CXXFLAGS"
|
||||
THREAD_CPPFLAGS="$STHREAD_CPPFLAGS"
|
||||
THREAD_CXXCPPFLAGS="$STHREAD_CXXCPPFLAGS"
|
||||
THREAD_LDFLAGS="$STHREAD_LDFLAGS"
|
||||
THREAD_LIBS="$STHREAD_LIBS"
|
||||
elif test "$THREAD_TYPE" = "posix"; then
|
||||
AC_DEFINE(LAM_HAVE_SOLARIS_THREADS, 0)
|
||||
AC_DEFINE(LAM_HAVE_POSIX_THREADS, 1)
|
||||
|
||||
THREAD_CFLAGS="$PTHREAD_CFLAGS"
|
||||
THREAD_FFLAGS="$PTHREAD_FFLAGS"
|
||||
THREAD_CXXFLAGS="$PTHREAD_CXXFLAGS"
|
||||
THREAD_CPPFLAGS="$PTHREAD_CPPFLAGS"
|
||||
THREAD_CXXCPPFLAGS="$PTHREAD_CXXCPPFLAGS"
|
||||
THREAD_LDFLAGS="$PTHREAD_LDFLAGS"
|
||||
THREAD_LIBS="$PTHREAD_LIBS"
|
||||
|
||||
LAM_CHECK_PTHREAD_PIDS
|
||||
elif test "$THREAD_TYPE" = "none"; then
|
||||
AC_DEFINE(LAM_HAVE_SOLARIS_THREADS, 0)
|
||||
AC_DEFINE(LAM_HAVE_POSIX_THREADS, 0)
|
||||
|
||||
TRHEAD_CFLAGS=
|
||||
THREAD_FFLAGS=
|
||||
THREAD_CXXFLAGS=
|
||||
THREAD_CPPFLAGS=
|
||||
THREAD_CXXCPPFLAGS=
|
||||
THREAD_LDFLAGS=
|
||||
THREAD_LIBS=
|
||||
else
|
||||
cat <<EOF
|
||||
|
||||
************************************************************************
|
||||
|
||||
LAM/MPI was unable to find threading support on your system. In the
|
||||
near future, the LAM development team is considering requiring
|
||||
threading support for proper LAM execution. This is in part because
|
||||
we are not aware of any users that do not have thread support - so we
|
||||
need you to e-mail us at lam@lam-mpi.org and let us know about this
|
||||
problem.
|
||||
|
||||
To build this version of LAM/MPI without thread support, re-run
|
||||
configure with the '--without-threads' option.
|
||||
|
||||
************************************************************************
|
||||
|
||||
EOF
|
||||
AC_MSG_ERROR(["*** Can not continue."])
|
||||
fi
|
||||
])
|
||||
|
@ -271,6 +271,12 @@ lam_show_title "System-specific tests"
|
||||
# all: type of getsockopt optlen
|
||||
# all: type of recvfrom optlen
|
||||
|
||||
#
|
||||
# Check out what thread support we have
|
||||
#
|
||||
|
||||
LAM_CONFIG_THREADS
|
||||
|
||||
#
|
||||
# File system case sensitivity
|
||||
#
|
||||
|
@ -10,9 +10,9 @@
|
||||
* need to #ifndef/#endif protection here.
|
||||
*/
|
||||
|
||||
/* If we're in C, bring in the bool type and true/false constants. */
|
||||
#include <limits.h>
|
||||
|
||||
/*
|
||||
* If we're in C, bring in the bool type and true/false constants.
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
#ifdef HAVE_STDBOOL_H
|
||||
#include <stdbool.h>
|
||||
@ -24,6 +24,7 @@ typedef enum { false, true } bool;
|
||||
/*
|
||||
* Maximum size of a filename path.
|
||||
*/
|
||||
#include <limits.h>
|
||||
#if defined(PATH_MAX)
|
||||
#define LAM_PATH_MAX (PATH_MAX + 1)
|
||||
#elif defined(_POSIX_PATH_MAX)
|
||||
@ -31,3 +32,8 @@ typedef enum { false, true } bool;
|
||||
#else
|
||||
#define LAM_PATH_MAX 256
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Do we have thread support?
|
||||
*/
|
||||
#define LAM_HAVE_THREADS (LAM_HAVE_SOLARIS_THREADS || LAM_HAVE_POSIX_THREADS)
|
||||
|
@ -2,7 +2,12 @@
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "lam_config.h"
|
||||
|
||||
#include "lam/threads/mutex.h"
|
||||
|
||||
bool lam_uses_threads;
|
||||
/*
|
||||
* Default to a safe value
|
||||
*/
|
||||
bool lam_uses_threads = (bool) LAM_HAVE_THREADS;
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user