1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
dnl
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.
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
dnl OMPI_CONFIG_SOLARIS_THREADS()
dnl
# ********************************************************************
#
# Internal macros - do not call from outside OMPI_CONFIG_SOLARIS_THREADS
#
# ********************************************************************
AC_DEFUN([OMPI_INTL_SOLARIS_TRY_LINK], [
# BEGIN: OMPI_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: OMPI_INTL_SOLARIS_TRY_LINK
])dnl
AC_DEFUN([OMPI_INTL_SOLARIS_TRY_LINK_F77], [
# BEGIN: OMPI_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
ompi_conftest_h="#include \"conftest.h\""
else
ompi_conftest_h=""
fi
cat > conftest.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include <thread.h>
$ompi_conftest_h
#ifdef __cplusplus
extern "C" {
#endif
void ompi_pthread()
{
thread_t th;
thr_join(th, 0, 0);
thr_create(0,0,0,0,0,0);
}
#ifdef __cplusplus
}
#endif
EOF
# Try the compile
OMPI_LOG_COMMAND(
[$CC $CFLAGS -I. -c conftest.c],
OMPI_LOG_COMMAND(
[$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
[HAPPY=1],
[HAPPY=0]),
[HAPPY=0])
if test "$HAPPY" = "1"; then
$1
else
OMPI_LOG_MSG([here is the C program:], 1)
OMPI_LOG_FILE([conftest.c])
if test -f conftest.h; then
OMPI_LOG_MSG([here is contest.h:], 1)
OMPI_LOG_FILE([conftest.h])
fi
OMPI_LOG_MSG([here is the fortran program:], 1)
OMPI_LOG_FILE([conftestf.f])
$2
fi
unset HAPPY ompi_conftest_h
rm -rf conftest*
# END: OMPI_INTL_SOLARIS_TRY_LINK_F77
])dnl
AC_DEFUN([OMPI_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)
OMPI_INTL_SOLARIS_TRY_LINK(ompi_sthread_c_success=1,
ompi_sthread_c_success=0)
AC_LANG_POP(C)
if test "$ompi_sthread_c_success" = "1"; then
AC_MSG_RESULT([yes - $style])
else
AC_MSG_RESULT([no])
fi
])dnl
AC_DEFUN([OMPI_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++)
OMPI_INTL_SOLARIS_TRY_LINK(ompi_sthread_cxx_success=1,
ompi_sthread_cxx_success=0)
AC_LANG_POP(C++)
if test "$ompi_sthread_cxx_success" = "1"; then
AC_MSG_RESULT([yes - $style])
else
AC_MSG_RESULT([no])
fi
])dnl
AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS_FC], [
if test "$OMPI_WANT_F77_BINDINGS" = "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)
OMPI_INTL_SOLARIS_TRY_LINK_F77(ompi_sthread_f77_success=1,
ompi_sthread_f77_success=0)
AC_LANG_POP(C)
if test "$ompi_sthread_f77_success" = "1"; then
AC_MSG_RESULT([yes - $style])
else
AC_MSG_RESULT([no])
fi
else
ompi_sthread_f77_success=1
fi
])dnl
AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS],[
ompi_sthread_c_success=0
ompi_sthread_f77_success=0
ompi_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],
[OMPI_CONFIG_SOLARIS_THREADS_C],
[ompi_sthread_c_success=1])
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[OMPI_CONFIG_SOLARIS_THREADS_CXX],
[ompi_sthread_cxx_success=1])
AC_PROVIDE_IFELSE([AC_PROG_F77],
[OMPI_CONFIG_SOLARIS_THREADS_FC],
[ompi_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 "$ompi_sthread_c_success" = "1" -a \
"$ompi_sthread_cxx_success" = "1" -a \
"$ompi_sthread_f77_success" = "1"; then
internal_useless=1
$1
else
internal_useless=1
$2
fi
unset ompi_sthread_c_success ompi_sthread_f77_success ompi_sthread_cxx_success
unset internal_useless
])dnl
|