From b8c41c8ed2c55f001b14b0a432f4daa73155d278 Mon Sep 17 00:00:00 2001 From: Chris Fairles Date: Thu, 28 Aug 2008 10:22:19 +0000 Subject: [PATCH] acinclude.m4 ([GLIBCXX_CHECK_GTHREADS]): New. 2008-08-28 Chris Fairles * acinclude.m4 ([GLIBCXX_CHECK_GTHREADS]): New. Checks for gthread support used by c++0x thread library. * configure.ac: Test unconditionally. * configure: Regenerate. * config.h.in: Regenerate. From-SVN: r139705 --- libstdc++-v3/ChangeLog | 8 ++++ libstdc++-v3/acinclude.m4 | 39 +++++++++++++++++++ libstdc++-v3/config.h.in | 3 ++ libstdc++-v3/configure | 97 ++++++++++++++++++++++++++++++++++++++++++++++- libstdc++-v3/configure.ac | 7 +++- 5 files changed, 150 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 43a027c..c9ca0a8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2008-08-28 Chris Fairles + + * acinclude.m4 ([GLIBCXX_CHECK_GTHREADS]): New. Checks for gthread + support used by c++0x thread library. + * configure.ac: Test unconditionally. + * configure: Regenerate. + * config.h.in: Regenerate. + 2008-08-27 Benjamin Kosnik * doc/Makefile.am: Edit xml file list. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 8ea21ce..052515b 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -2816,6 +2816,45 @@ AC_DEFUN([GLIBCXX_ENABLE_THREADS], [ ]) +dnl +dnl Check if gthread implementation defines the types and functions +dnl required by the c++0x thread library. Conforming gthread +dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x. +dnl +AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc" + + target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` + case $target_thread_file in + posix) + CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS" + esac + + AC_MSG_CHECKING([for gthreads library]) + + AC_TRY_COMPILE([#include "gthr.h"], + [ + #ifndef __GTHREADS_CXX0X + #error + #endif + ], [ac_has_gthreads=yes], [ac_has_gthreads=no]) + + AC_MSG_RESULT([$ac_has_gthreads]) + + if test x"$ac_has_gthreads" = x"yes"; then + AC_DEFINE(_GLIBCXX_HAS_GTHREADS, 1, + [Define if gthreads library is available.]) + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + + # Check whether LC_MESSAGES is available in . # Ulrich Drepper , 1995. # diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 0074772..91e6cb8 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -698,6 +698,9 @@ /* Define if a fully dynamic basic_string is wanted. */ #undef _GLIBCXX_FULLY_DYNAMIC_STRING +/* Define if gthreads library is available. */ +#undef _GLIBCXX_HAS_GTHREADS + /* Define to 1 if a full hosted library is built, or 0 if freestanding. */ #undef _GLIBCXX_HOSTED diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index bbeb6f3..4287de5 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -14157,7 +14157,7 @@ _ACEOF -# Checks for compiler support that don't require linking. +# Checks for compiler support that doesn't require linking. # All these tests are for C++; save the language and the compiler flags. # The CXXFLAGS thing is suspicious, but based on similar bits previously @@ -17363,7 +17363,7 @@ _ACEOF fi -# Checks for operating systems support that don't require linking. +# Checks for operating systems support that doesn't require linking. echo "$as_me:$LINENO: checking for EOWNERDEAD" >&5 @@ -21576,6 +21576,99 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +# For gthread support + + + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc" + + target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` + case $target_thread_file in + posix) + CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS" + esac + + echo "$as_me:$LINENO: checking for gthreads library" >&5 +echo $ECHO_N "checking for gthreads library... $ECHO_C" >&6 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include "gthr.h" +int +main () +{ + + #ifndef __GTHREADS_CXX0X + #error + #endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_has_gthreads=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_has_gthreads=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + + echo "$as_me:$LINENO: result: $ac_has_gthreads" >&5 +echo "${ECHO_T}$ac_has_gthreads" >&6 + + if test x"$ac_has_gthreads" = x"yes"; then + +cat >>confdefs.h <<\_ACEOF +#define _GLIBCXX_HAS_GTHREADS 1 +_ACEOF + + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + if test "${ac_cv_header_locale_h+set}" = set; then echo "$as_me:$LINENO: checking for locale.h" >&5 diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 5704b4b..ff388ab 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -100,7 +100,7 @@ GLIBCXX_ENABLE_PCH($is_hosted) GLIBCXX_ENABLE_ATOMIC_BUILTINS GLIBCXX_ENABLE_THREADS -# Checks for compiler support that don't require linking. +# Checks for compiler support that doesn't require linking. GLIBCXX_CHECK_COMPILER_FEATURES GLIBCXX_CHECK_STANDARD_LAYOUT @@ -119,7 +119,7 @@ GLIBCXX_ENABLE_PARALLEL([yes]) GLIBCXX_ENABLE_CXX_FLAGS GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no]) -# Checks for operating systems support that don't require linking. +# Checks for operating systems support that doesn't require linking. GLIBCXX_CHECK_SYSTEM_ERROR # For the streamoff typedef. @@ -150,6 +150,9 @@ GLIBCXX_CHECK_GETTIMEOFDAY # NB: The default is [no], because otherwise it requires linking. GLIBCXX_ENABLE_CLOCK_GETTIME([no]) +# For gthread support +GLIBCXX_CHECK_GTHREADS + AC_LC_MESSAGES # Check for available headers. -- 2.7.4