2 dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 dnl University Research and Technology
4 dnl Corporation. All rights reserved.
5 dnl Copyright (c) 2004-2005 The University of Tennessee and The University
6 dnl of Tennessee Research Foundation. All rights
8 dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 dnl University of Stuttgart. All rights reserved.
10 dnl Copyright (c) 2004-2005 The Regents of the University of California.
11 dnl All rights reserved.
14 dnl Additional copyrights may follow
18 dnl OMPI_CONFIG_SOLARIS_THREADS()
21 # ********************************************************************
23 # Internal macros - do not call from outside OMPI_CONFIG_SOLARIS_THREADS
25 # ********************************************************************
27 AC_DEFUN([OMPI_INTL_SOLARIS_TRY_LINK], [
28 # BEGIN: OMPI_INTL_SOLARIS_TRY_LINK
30 # Make sure that we can run a small application in C or C++, which
31 # ever is the current language. Do make sure that C or C++ is the
33 AC_TRY_LINK([#include <thread.h>],
34 [thread_t th; thr_join(th, 0, 0);
35 thr_create(0,0,0,0,0,0); ],
37 # END: OMPI_INTL_SOLARIS_TRY_LINK
41 AC_DEFUN([OMPI_INTL_SOLARIS_TRY_LINK_F77], [
42 # BEGIN: OMPI_INTL_SOLARIS_TRY_LINK_F77
44 # Make sure that we can run a small application in Fortran, with
45 # pthreads living in a C object file
48 cat > conftestf.f <<EOF
56 if test -f conftest.h; then
57 ompi_conftest_h="#include \"conftest.h\""
61 cat > conftest.c <<EOF
74 thr_create(0,0,0,0,0,0);
83 [$CC $CFLAGS -I. -c conftest.c],
85 [$F77 $FFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS],
90 if test "$HAPPY" = "1"; then
93 OMPI_LOG_MSG([here is the C program:], 1)
94 OMPI_LOG_FILE([conftest.c])
95 if test -f conftest.h; then
96 OMPI_LOG_MSG([here is contest.h:], 1)
97 OMPI_LOG_FILE([conftest.h])
99 OMPI_LOG_MSG([here is the fortran program:], 1)
100 OMPI_LOG_FILE([conftestf.f])
104 unset HAPPY ompi_conftest_h
106 # END: OMPI_INTL_SOLARIS_TRY_LINK_F77
110 AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS_C], [
111 if test "$BASECC" = "cc"; then
113 style="Workshop/Forte"
115 STHREAD_CPPFLAGS="-D_REENTRANT"
116 STHREAD_LIBS="-lthread"
119 AC_MSG_CHECKING([if C compiler and Solaris threads work])
120 CFLAGS="$STHREAD_CFLAGS $CFLAGS_orig"
121 CPPFLAGS="$STHREAD_CPPFLAGS $CPPFLAGS_orig"
122 LDFLAGS="$STHREAD_LDFLAGS $LDFLAGS_orig"
123 LIBS="$STHREAD_LIBS $LIBS_orig"
125 OMPI_INTL_SOLARIS_TRY_LINK(ompi_sthread_c_success=1,
126 ompi_sthread_c_success=0)
128 if test "$ompi_sthread_c_success" = "1"; then
129 AC_MSG_RESULT([yes - $style])
136 AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS_CXX], [
137 if test "$BASECXX" = "CC"; then
138 STHREAD_CXXFLAGS="-mt"
139 style="Workshop/Forte"
140 elif test "$BASECXX" = "KCC"; then
141 STHREAD_CXXFLAGS="--backend -mt"
144 STHREAD_CXXCPPFLAGS="-D_REENTRANT"
145 STHREAD_LIBS="-lthread"
148 CXXFLAGS="$STHREAD_CXXFLAGS $CXXFLAGS_orig"
149 CXXCPPFLAGS="$STHREAD_CXXPPFLAGS $CXXPPFLAGS_orig"
150 LDFLAGS="$STHREAD_LDFLAGS $LDFLAGS_orig"
151 LIBS="$STHREAD_LIBS $LIBS_orig"
152 AC_MSG_CHECKING([if C++ compiler and Solaris threads work])
154 OMPI_INTL_SOLARIS_TRY_LINK(ompi_sthread_cxx_success=1,
155 ompi_sthread_cxx_success=0)
157 if test "$ompi_sthread_cxx_success" = "1"; then
158 AC_MSG_RESULT([yes - $style])
165 AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS_FC], [
166 if test "$OMPI_WANT_F77_BINDINGS" = "1"; then
167 if test "$BASEFC" = "f77"; then
169 style="Workshop/Forte"
171 STHREAD_LIBS="-lthread"
174 FFLAGS="$STHREAD_FFLAGS $FFLAGS_orig"
175 CFLAGS="$STHREAD_CFLAGS $CFLAGS_orig"
176 CPPFLAGS="$STHREAD_CPPFLAGS $CPPFLAGS_orig"
177 LDFLAGS="$STHREAD_LDFLAGS $LDFLAGS_orig"
178 LIBS="$STHREAD_LIBS $LIBS_orig"
179 AC_MSG_CHECKING([if F77 compiler and Solaris threads work])
181 OMPI_INTL_SOLARIS_TRY_LINK_F77(ompi_sthread_f77_success=1,
182 ompi_sthread_f77_success=0)
184 if test "$ompi_sthread_f77_success" = "1"; then
185 AC_MSG_RESULT([yes - $style])
190 ompi_sthread_f77_success=1
195 AC_DEFUN([OMPI_CONFIG_SOLARIS_THREADS],[
196 ompi_sthread_c_success=0
197 ompi_sthread_f77_success=0
198 ompi_sthread_cxx_success=0
200 orig_CFLAGS="$CFLAGS"
201 orig_FFLAGS="$FFLAGS"
202 orig_CXXFLAGS="$CXXFLAGS"
203 orig_CPPFLAGS="$CPPFLAGS"
204 orig_CXXCPPFLAGS="$CXXCPPFLAGS"
205 orig_LDFLAGS="$LDFLAGS"
216 # Only run C++ and Fortran if those compilers already configured
217 AC_PROVIDE_IFELSE([AC_PROG_CC],
218 [OMPI_CONFIG_SOLARIS_THREADS_C],
219 [ompi_sthread_c_success=1])
221 AC_PROVIDE_IFELSE([AC_PROG_CXX],
222 [OMPI_CONFIG_SOLARIS_THREADS_CXX],
223 [ompi_sthread_cxx_success=1])
225 AC_PROVIDE_IFELSE([AC_PROG_F77],
226 [OMPI_CONFIG_SOLARIS_THREADS_FC],
227 [ompi_sthread_f77_success=1])
229 CFLAGS="$orig_CFLAGS"
230 FFLAGS="$orig_FFLAGS"
231 CXXFLAGS="$orig_CXXFLAGS"
232 CPPFLAGS="$orig_CPPFLAGS"
233 CXXCPPFLAGS="$orig_CXXCPPFLAGS"
234 LDFLAGS="$orig_LDFLAGS"
237 if test "$ompi_sthread_c_success" = "1" -a \
238 "$ompi_sthread_cxx_success" = "1" -a \
239 "$ompi_sthread_f77_success" = "1"; then
247 unset ompi_sthread_c_success ompi_sthread_f77_success ompi_sthread_cxx_success
248 unset internal_useless