3 dnl Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
4 dnl C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 dnl E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 dnl J. Wenninger, Institut f. Computersprachen - TU Wien
8 dnl This file is part of CACAO.
10 dnl This program is free software; you can redistribute it and/or
11 dnl modify it under the terms of the GNU General Public License as
12 dnl published by the Free Software Foundation; either version 2, or (at
13 dnl your option) any later version.
15 dnl This program is distributed in the hope that it will be useful, but
16 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 dnl General Public License for more details.
20 dnl You should have received a copy of the GNU General Public License
21 dnl along with this program; if not, write to the Free Software
22 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 dnl check which thread implementation should be used
28 AC_DEFUN([AC_CHECK_ENABLE_THREADS],[
29 AC_MSG_CHECKING(whether to include threads support)
30 AC_ARG_ENABLE([threads],
31 [AS_HELP_STRING(--enable-threads,enable threads support (none,native) [[default=native]])],
32 [case "${enableval}" in
42 AC_MSG_ERROR($enableval is an unknown thread package)
45 [ENABLE_THREADS=posix])
47 AC_MSG_RESULT(${ENABLE_THREADS})
48 AM_CONDITIONAL([ENABLE_THREADS], test x"${ENABLE_THREADS}" != "xno")
50 case "${ENABLE_THREADS}" in
52 dnl no threads for boehm
53 ac_configure_args="$ac_configure_args --disable-boehm-threads"
57 AC_DEFINE([ENABLE_THREADS], 1, [enable threads])
58 AC_CHECK_LIB(pthread, main)
60 OS_FLAGS="$OS_FLAGS -D_REENTRANT"
62 dnl We changed OS_FLAGS, set CFLAGS again.
63 CFLAGS="$OPT_CFLAGS $ARCH_FLAGS $OS_FLAGS $CC_FLAGS"
64 CXXFLAGS="$OPT_CXXFLAGS $ARCH_FLAGS $OS_FLAGS $CXX_FLAGS"
66 dnl tell boehm to support threads as well
67 ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
73 AC_DEFUN([AC_CHECK_USE___THREAD],[
74 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features [[default=yes]])], [use__thread=$enableval], [use__thread=yes])
76 dnl Check whether the compiler supports the __thread keyword.
77 if test "x$use__thread" != xno; then
78 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
79 [cat > conftest.c <<\EOF
82 if AC_TRY_COMMAND([${CC-cc} $ARCH_CFLAGS $OPT_CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
83 ac_cv_gcc___thread=yes
88 if test "$ac_cv_gcc___thread" = yes; then
89 AC_DEFINE([HAVE___THREAD], 1, [have __thread])