2004-01-14 10:06:57 +03:00
|
|
|
dnl
|
2005-11-05 22:57:48 +03:00
|
|
|
dnl Copyright (c) 2004-2005 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.
|
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
|
|
|
dnl OMPI_CONFIG_SOLARIS_THREADS()
|
2004-01-14 10:06:57 +03:00
|
|
|
dnl
|
|
|
|
|
|
|
|
# ********************************************************************
|
|
|
|
#
|
2004-06-07 19:33:53 +04:00
|
|
|
# Internal macros - do not call from outside OMPI_CONFIG_SOLARIS_THREADS
|
2004-01-14 10:06:57 +03:00
|
|
|
#
|
|
|
|
# ********************************************************************
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_INTL_SOLARIS_TRY_LINK], [
|
|
|
|
# BEGIN: OMPI_INTL_SOLARIS_TRY_LINK
|
2004-01-14 10:06:57 +03:00
|
|
|
#
|
|
|
|
# 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])
|
2004-06-07 19:33:53 +04:00
|
|
|
# END: OMPI_INTL_SOLARIS_TRY_LINK
|
2004-01-14 10:06:57 +03:00
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_INTL_SOLARIS_TRY_LINK_F77], [
|
|
|
|
# BEGIN: OMPI_INTL_SOLARIS_TRY_LINK_F77
|
2004-01-14 10:06:57 +03:00
|
|
|
#
|
|
|
|
# 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
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_conftest_h="#include \"conftest.h\""
|
2004-01-14 10:06:57 +03:00
|
|
|
else
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_conftest_h=""
|
2004-01-14 10:06:57 +03:00
|
|
|
fi
|
|
|
|
cat > conftest.c <<EOF
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <thread.h>
|
2004-06-07 19:33:53 +04:00
|
|
|
$ompi_conftest_h
|
2004-01-14 10:06:57 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2004-06-07 19:33:53 +04:00
|
|
|
void ompi_pthread()
|
2004-01-14 10:06:57 +03:00
|
|
|
{
|
|
|
|
thread_t th;
|
|
|
|
thr_join(th, 0, 0);
|
|
|
|
thr_create(0,0,0,0,0,0);
|
|
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Try the compile
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_LOG_COMMAND(
|
2004-01-14 10:06:57 +03:00
|
|
|
[$CC $CFLAGS -I. -c conftest.c],
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_LOG_COMMAND(
|
2005-06-01 14:53:44 +04:00
|
|
|
[$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
|
2004-01-14 10:06:57 +03:00
|
|
|
[HAPPY=1],
|
|
|
|
[HAPPY=0]),
|
|
|
|
[HAPPY=0])
|
|
|
|
|
|
|
|
if test "$HAPPY" = "1"; then
|
|
|
|
$1
|
|
|
|
else
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_LOG_MSG([here is the C program:], 1)
|
|
|
|
OMPI_LOG_FILE([conftest.c])
|
2004-01-14 10:06:57 +03:00
|
|
|
if test -f conftest.h; then
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_LOG_MSG([here is contest.h:], 1)
|
|
|
|
OMPI_LOG_FILE([conftest.h])
|
2004-01-14 10:06:57 +03:00
|
|
|
fi
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_LOG_MSG([here is the fortran program:], 1)
|
|
|
|
OMPI_LOG_FILE([conftestf.f])
|
2004-01-14 10:06:57 +03:00
|
|
|
$2
|
|
|
|
fi
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
unset HAPPY ompi_conftest_h
|
2004-01-14 10:06:57 +03:00
|
|
|
/bin/rm -f conftest*
|
2004-06-07 19:33:53 +04:00
|
|
|
# END: OMPI_INTL_SOLARIS_TRY_LINK_F77
|
2004-01-14 10:06:57 +03:00
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS_C], [
|
2004-01-14 10:06:57 +03:00
|
|
|
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)
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_INTL_SOLARIS_TRY_LINK(ompi_sthread_c_success=1,
|
|
|
|
ompi_sthread_c_success=0)
|
2004-01-14 10:06:57 +03:00
|
|
|
AC_LANG_POP(C)
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$ompi_sthread_c_success" = "1"; then
|
2004-01-14 10:06:57 +03:00
|
|
|
AC_MSG_RESULT([yes - $style])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS_CXX], [
|
2004-01-14 10:06:57 +03:00
|
|
|
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++)
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_INTL_SOLARIS_TRY_LINK(ompi_sthread_cxx_success=1,
|
|
|
|
ompi_sthread_cxx_success=0)
|
2004-01-14 10:06:57 +03:00
|
|
|
AC_LANG_POP(C++)
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$ompi_sthread_cxx_success" = "1"; then
|
2004-01-14 10:06:57 +03:00
|
|
|
AC_MSG_RESULT([yes - $style])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS_FC], [
|
|
|
|
if test "$OMPI_WANT_F77_BINDINGS" = "1"; then
|
2004-01-14 10:06:57 +03:00
|
|
|
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)
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_INTL_SOLARIS_TRY_LINK_F77(ompi_sthread_f77_success=1,
|
|
|
|
ompi_sthread_f77_success=0)
|
2004-01-14 10:06:57 +03:00
|
|
|
AC_LANG_POP(C)
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$ompi_sthread_f77_success" = "1"; then
|
2004-01-14 10:06:57 +03:00
|
|
|
AC_MSG_RESULT([yes - $style])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
else
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_sthread_f77_success=1
|
2004-01-14 10:06:57 +03:00
|
|
|
fi
|
|
|
|
])dnl
|
|
|
|
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS],[
|
|
|
|
ompi_sthread_c_success=0
|
|
|
|
ompi_sthread_f77_success=0
|
|
|
|
ompi_sthread_cxx_success=0
|
2004-01-14 10:06:57 +03:00
|
|
|
|
|
|
|
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],
|
2004-06-07 19:33:53 +04:00
|
|
|
[OMPI_CONFIG_SOLARIS_THREADS_C],
|
|
|
|
[ompi_sthread_c_success=1])
|
2004-01-14 10:06:57 +03:00
|
|
|
|
|
|
|
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
2004-06-07 19:33:53 +04:00
|
|
|
[OMPI_CONFIG_SOLARIS_THREADS_CXX],
|
|
|
|
[ompi_sthread_cxx_success=1])
|
2004-01-14 10:06:57 +03:00
|
|
|
|
2004-03-28 14:02:38 +04:00
|
|
|
AC_PROVIDE_IFELSE([AC_PROG_F77],
|
2004-06-07 19:33:53 +04:00
|
|
|
[OMPI_CONFIG_SOLARIS_THREADS_FC],
|
|
|
|
[ompi_sthread_f77_success=1])
|
2004-01-14 10:06:57 +03:00
|
|
|
|
|
|
|
CFLAGS="$orig_CFLAGS"
|
|
|
|
FFLAGS="$orig_FFLAGS"
|
|
|
|
CXXFLAGS="$orig_CXXFLAGS"
|
|
|
|
CPPFLAGS="$orig_CPPFLAGS"
|
|
|
|
CXXCPPFLAGS="$orig_CXXCPPFLAGS"
|
|
|
|
LDFLAGS="$orig_LDFLAGS"
|
|
|
|
LIBS="$orig_LIBS"
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$ompi_sthread_c_success" = "1" -a \
|
|
|
|
"$ompi_sthread_cxx_success" = "1" -a \
|
|
|
|
"$ompi_sthread_f77_success" = "1"; then
|
2004-01-14 10:06:57 +03:00
|
|
|
internal_useless=1
|
|
|
|
$1
|
|
|
|
else
|
|
|
|
internal_useless=1
|
|
|
|
$2
|
|
|
|
fi
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
unset ompi_sthread_c_success ompi_sthread_f77_success ompi_sthread_cxx_success
|
2004-01-14 10:06:57 +03:00
|
|
|
unset internal_useless
|
|
|
|
])dnl
|
|
|
|
|