OSDN Git Service

2010-09-15 Paolo Carlini <paolo.carlini@oracle.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / lib / libstdc++.exp
index 4603305..17699ca 100644 (file)
@@ -1,11 +1,11 @@
 # libstdc++ "tool init file" for DejaGNU
 
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 # Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 # 
 # This program is distributed in the hope that it will be useful,
@@ -14,9 +14,8 @@
 # GNU General Public License for more details.
 # 
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
 
 
 # Define callbacks and load other libraries.  This file is loaded relatively
@@ -53,6 +52,8 @@ load_gcc_lib target-supports-dg.exp
 load_lib prune.exp
 load_lib dg-options.exp
 load_gcc_lib target-libpath.exp
+load_gcc_lib timeout.exp
+load_gcc_lib timeout-dg.exp
 load_gcc_lib wrapper.exp
 
 # Useful for debugging.  Pass the name of a variable and the verbosity
@@ -81,22 +82,33 @@ proc v3-copy-files {srcfiles} {
 # Called once, during runtest.exp setup.
 proc libstdc++_init { testfile } {
     global env
-    global v3-sharedlib 
+    global v3-sharedlib v3-libgomp
     global srcdir blddir objdir tool_root_dir
-    global cc cxx cxxflags cxxldflags
+    global cc cxx cxxflags cxxpchflags cxxldflags
     global includes
     global gluefile wrap_flags
     global ld_library_path
     global target_triplet
     global flags_file
+    global tool_timeout
+    global DEFAULT_CXXFLAGS
+    global STATIC_LIBCXXFLAGS
 
     # We set LC_ALL and LANG to C so that we get the same error
     # messages as expected.
     setenv LC_ALL C
     setenv LANG C
 
+    # Many hosts now default to a non-ASCII C locale, however, so
+    # they can set a charset encoding here if they need.
+    if { [ishost "*-*-cygwin*"] } {
+      setenv LC_ALL C.ASCII
+      setenv LANG C.ASCII
+    }
+
     set blddir [lookfor_file [get_multilibs] libstdc++-v3]
     set flags_file "${blddir}/scripts/testsuite_flags"
+    set shlib_ext [get_shlib_extension]
     v3track flags_file 2
 
     # If a test doesn't have special options, use DEFAULT_CXXFLAGS.
@@ -105,7 +117,7 @@ proc libstdc++_init { testfile } {
     #   2) might need to be negated 
     # In particular, some tests have to be run without precompiled
     # headers, or without assertions.
-    global DEFAULT_CXXFLAGS
+
     if ![info exists DEFAULT_CXXFLAGS] then {
        set DEFAULT_CXXFLAGS ""
        # Host specific goo here.
@@ -123,17 +135,31 @@ proc libstdc++_init { testfile } {
     v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"]
     v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"]
 
+    set ld_library_path_tmp ""
+
     # Locate libgcc.a so we don't need to account for different values of
     # SHLIB_EXT on different platforms
     set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
     if {$gccdir != ""} {
         set gccdir [file dirname $gccdir]
+       append ld_library_path_tmp ":${gccdir}"
     }
     v3track gccdir 3
 
-    # Look for shared library. (ie libstdc++.so.)
+    # Locate libgomp. This is only required for parallel mode.
+    set v3-libgomp 0
+    set libgompdir [lookfor_file $blddir/../libgomp .libs/libgomp.$shlib_ext]
+    if {$libgompdir != ""} {
+       set v3-libgomp 1
+        set libgompdir [file dirname $libgompdir]
+       append ld_library_path_tmp ":${libgompdir}"
+       verbose -log "libgomp support detected"
+    }
+    v3track libgompdir 3
+
+    # Locate libstdc++ shared library. (ie libstdc++.so.)
     set v3-sharedlib 0
-    set sharedlibdir [lookfor_file $blddir src/.libs/libstdc++.so]
+    set sharedlibdir [lookfor_file $blddir src/.libs/libstdc++.$shlib_ext]
     if {$sharedlibdir != ""} {
        if { [string match "*-*-linux*" $target_triplet] && [isnative] } {
            set v3-sharedlib 1
@@ -142,11 +168,19 @@ proc libstdc++_init { testfile } {
     }
     v3track v3-sharedlib 3
 
+    set STATIC_LIBCXXFLAGS ""
+    set staticlibdir [lookfor_file $blddir src/.libs/libstdc++.a]
+    if {$staticlibdir != ""} {
+       set staticlibdir [file dirname $staticlibdir]
+       # Some targets use libstdc++.a%s in their specs, so they need a
+       # -B option for uninstalled testing.
+       set STATIC_LIBCXXFLAGS " -B${staticlibdir} "
+    }
+
     # Compute what needs to be added to the existing LD_LIBRARY_PATH.
     if {$gccdir != ""} {
-       set ld_library_path ""
-       append ld_library_path ":${gccdir}"
        set compiler ${gccdir}/g++
+       set ld_library_path ${ld_library_path_tmp}
        append ld_library_path ":${blddir}/src/.libs"
 
        if { [is_remote host] == 0 && [which $compiler] != 0 } {
@@ -171,9 +205,13 @@ proc libstdc++_init { testfile } {
        set compiler [transform "g++"]
     }
 
+    # Set the default timeout for v3 tests.
+    set tool_timeout 600
+
     # Default settings.
     set cxx [transform "g++"]
     set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0"
+    set cxxpchflags ""
     set cxxldflags ""
     set cc [transform "gcc"]
     # Locate testsuite_hooks.h and other testsuite headers.
@@ -185,14 +223,23 @@ proc libstdc++_init { testfile } {
        # directory, and then add that to the search path.
        foreach src [glob "${srcdir}/util/*.h" \
                          "${srcdir}/util/*.cc" \
-                         "${srcdir}/util/*/*.hpp" \
+                         "${srcdir}/util/*.tcc" \
+                         "${srcdir}/util/*.hpp" \
+                         "${srcdir}/util/*/*.h" \
                          "${srcdir}/util/*/*.cc" \
+                         "${srcdir}/util/*/*.tcc" \
                          "${srcdir}/util/*/*.hpp" \
+                         "${srcdir}/util/*/*/*.h" \
                          "${srcdir}/util/*/*/*.cc" \
+                         "${srcdir}/util/*/*/*.tcc" \
                          "${srcdir}/util/*/*/*.hpp" \
+                         "${srcdir}/util/*/*/*/*.h" \
                          "${srcdir}/util/*/*/*/*.cc" \
+                         "${srcdir}/util/*/*/*/*.tcc" \
                          "${srcdir}/util/*/*/*/*.hpp" \
+                         "${srcdir}/util/*/*/*/*/*.h" \
                          "${srcdir}/util/*/*/*/*/*.cc" \
+                         "${srcdir}/util/*/*/*/*/*.tcc" \
                          "${srcdir}/util/*/*/*/*/*.hpp" ] {
            # Remove everything up to "util/..."
            set dst [string range $src [string length "${srcdir}/"] end]
@@ -211,6 +258,7 @@ proc libstdc++_init { testfile } {
         # If we find a testsuite_flags file, we're testing in the build dir.
        set cxx [exec sh $flags_file --build-cxx]
        set cxxflags [exec sh $flags_file --cxxflags]
+       set cxxpchflags [exec sh $flags_file --cxxpchflags]
        set cxxldflags [exec sh $flags_file --cxxldflags]
        set cc [exec sh $flags_file --build-cc]
        set includes [exec sh $flags_file --build-includes]
@@ -227,23 +275,29 @@ proc libstdc++_init { testfile } {
     # this check until $cxx and such have been initialized because we
     # perform a test compilation.  (Ideally, gcc --print-file-name would
     # list PCH files, but it does not.)
-    global PCH_CXXFLAGS
-    if ![info exists PCH_CXXFLAGS] then {
+    if { $cxxpchflags != "" } {
        set src "config[pid].cc"
        set f [open $src "w"]
        puts $f "int main () {}"
        close $f
 
+       # Fixme: "additional_flags=$cxxpchflags" fails, but would be
+       # useful as then the requested variant of the pre-build PCH
+       # files could be tested to see if it works.
        set lines [v3_target_compile $src "config[pid].o" object \
-                "additional_flags=-include additional_flags=bits/stdtr1c++.h"]
-       if {$lines == "" } {
-#          set PCH_CXXFLAGS "-include bits/extc++.h"
-#          set PCH_CXXFLAGS "-include bits/stdtr1c++.h"
-           set PCH_CXXFLAGS "-include bits/stdc++.h"
-       } else {
-           set PCH_CXXFLAGS ""
-       }
+                  "additional_flags=-include additional_flags=bits/stdc++.h"]
+       if { $lines != "" } {
+           verbose -log "Requested PCH file: $cxxpchflags"
+           verbose -log "is not working, and will not be used."
+           set cxxpchflags ""
+       } 
        file delete $src
+     } 
+    v3track cxxpchflags 2
+
+    global PCH_CXXFLAGS
+    if ![info exists PCH_CXXFLAGS] then {
+       set PCH_CXXFLAGS $cxxpchflags
        v3track PCH_CXXFLAGS 2
     }
 
@@ -320,11 +374,31 @@ proc libstdc++-dg-test { prog do_what extra_tool_flags } {
     # There is a libstdc++_compile made for us by default (via the tool-
     # and-target file), but the defaults are lacking in goodness.
     set comp_output [$select_compile "$prog" "$output_file" "$compile_type" $options];
-    set comp_output [ prune_g++_output $comp_output ];
 
     return [list $comp_output $output_file]
 }
 
+# Override the DejaGnu dg-test in order to clear flags after a test, as
+# is done for compiler tests in gcc-dg.exp.
+
+if { [info procs saved-dg-test] == [list] } {
+    rename dg-test saved-dg-test
+
+    proc dg-test { args } {
+       global additional_prunes
+       global errorInfo
+
+       if { [ catch { eval saved-dg-test $args } errmsg ] } {
+           set saved_info $errorInfo
+           set additional_prunes ""
+           unset_timeout_vars
+           error $errmsg $saved_info
+       }
+       set additional_prunes ""
+       unset_timeout_vars
+    }
+}
+
 # True if the library supports wchar_t.
 set v3-wchar_t 0
 
@@ -343,6 +417,7 @@ proc v3_target_compile { source dest type options } {
     global cxxflags
     global cxxldflags
     global includes
+    global STATIC_LIBCXXFLAGS
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
         lappend options "libs=${gluefile}"
@@ -352,14 +427,14 @@ proc v3_target_compile { source dest type options } {
     set cxx_final $cxx
     set cxxlibglossflags  [libgloss_link_flags]
     set cxx_final [concat $cxx_final $cxxlibglossflags]
+    set cxx_final [concat $cxx_final $STATIC_LIBCXXFLAGS]
     set cxx_final [concat $cxx_final $cxxflags]
     set cxx_final [concat $cxx_final $includes]
 
     # Flag setting based on type argument.
     if { $type == "executable" } {
        # Link the support objects into executables.
-        set cxx_final [concat $cxx_final $cxxldflags]
-       lappend options "additional_flags=./libtestc++.a"
+       lappend options "additional_flags=./libtestc++.a $cxxldflags"
     } else {
        if { $type == "sharedlib" } {
            # Don't link in anything.
@@ -368,7 +443,7 @@ proc v3_target_compile { source dest type options } {
     }
 
     lappend options "compiler=$cxx_final"
-    lappend options "timeout=600"
+    lappend options "timeout=[timeout_value]"
 
     return [target_compile $source $dest $type $options]
 }
@@ -383,6 +458,8 @@ proc v3_target_compile_as_c { source dest type options } {
     global flags_file
     global blddir
     global cc
+    global cxxflags
+    global STATIC_LIBCXXFLAGS
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
         lappend options "libs=${gluefile}"
@@ -393,6 +470,8 @@ proc v3_target_compile_as_c { source dest type options } {
     set cc_final $cc
     set cxxlibglossflags [libgloss_link_flags]
     set cc_final [concat $cc_final $cxxlibglossflags]
+    set cc_final [concat $cc_final $STATIC_LIBCXXFLAGS]
+    set cc_final [concat $cc_final $cxxflags]
     set cc_final [concat $cc_final $includes]
     regsub -all {\s[-]nostdinc[+][+]} $cc_final "" cc_final
 
@@ -423,15 +502,16 @@ proc v3_target_compile_as_c { source dest type options } {
        set includestarget "${includesbase}/${machine}"
        set cc_final [concat $cc_final "-I$includesbase -I$includestarget"]
 
-        set libsup "${comp_base_dir}/lib"
+        set libdir "-L${comp_base_dir}/lib"
     } else {
-        set libsup "${blddir}/libsupc++/.libs"
+        set libdir "-L${blddir}/libsupc++/.libs"
+       set libdir [concat $libdir "-L${blddir}/src/.libs"]
     }
 
-    set cc_final [concat $cc_final "-L$libsup"]
+    set cc_final [concat $cc_final "$libdir"]
 
     lappend options "compiler=$cc_final"
-    lappend options "timeout=600"
+    lappend options "timeout=[timeout_value]"
 
     return [target_compile $source $dest $type $options]
 }
@@ -492,7 +572,7 @@ proc v3-build_support { } {
     # Build the support objects.
     set source_files [list testsuite_abi.cc testsuite_allocator.cc \
                          testsuite_character.cc testsuite_hooks.cc \
-                rng/twister_rand_gen.cc io/verified_cmd_line_input.cc \
+                         io/verified_cmd_line_input.cc \
                          io/prog_bar.cc performance/time/elapsed_timer.cc ]
     foreach f $source_files {
        set obj [file rootname $f].o
@@ -587,15 +667,20 @@ proc check_v3_target_fileio { } {
        puts $f "int main ()"
        puts $f "{"
        puts $f "  int fd  = open (\".\", O_RDONLY);"
+       puts $f "  int ret = 0;"
        puts $f "  if (fd == -1)"
        puts $f "  {"
        puts $f "    int err = errno;"
        puts $f "    if (err == EIO || err == ENOSYS)"
-       puts $f "      return 1;"
+       puts $f "      ret = 1;"
        puts $f "  }"
        puts $f "  else"
+       puts $f "  {"
+       puts $f "    if (lseek (fd, 0, SEEK_CUR) == -1)"
+       puts $f "      ret = 1;"
        puts $f "    close (fd);"
-       puts $f "  return 0;"
+       puts $f "  }"
+       puts $f "  return ret;"
        puts $f "}" 
        close $f
 
@@ -661,7 +746,7 @@ proc check_v3_target_c_std { } {
        puts $f "  int i = std::tr1::isnan(f);"
        puts $f "  "
        puts $f "  using std::wctomb;"
-       puts $f "  return 0;"
+       puts $f "  return i;"
        puts $f "}" 
        close $f
 
@@ -745,71 +830,95 @@ proc check_v3_target_time { } {
     return $et_time_saved
 }
 
-proc check_v3_target_namedlocale { } {
-    global et_namedlocale_saved
-    global et_namedlocale_target_name
+proc check_v3_target_namedlocale { args } {
+    global et_namedlocale
     global tool        
 
-    if { ![info exists et_namedlocale_target_name] } {
-       set et_namedlocale_target_name ""
+    set et_namedlocale 0
+
+    # Set up, compile, and execute a C++ test program that tries to use
+    # the required named locale.
+    set exe nlocale[pid].x
+
+    if ![file exists ./$exe] {
+      set src nlocale[pid].cc
+
+      set f [open $src "w"]
+      puts $f "#include <locale>"
+      puts $f "#include <cstdio>"
+      puts $f "using namespace std;"   
+      puts $f "int main (int argc, char** argv)"
+      puts $f "{"
+      puts $f "  try"  
+      puts $f "  {"
+      puts $f "    locale(*(argv + 1));"
+      puts $f "    return 0;"
+      puts $f "  }"
+      puts $f "  catch(...)"
+      puts $f "  {"
+      puts $f "    printf(\"locale '%s' not supported\\n\", *(argv + 1));"
+      puts $f "    return 1;"
+      puts $f "  }"    
+      puts $f "}"
+      close $f
+
+      set lines [v3_target_compile $src $exe executable ""]
+      #file delete $src
+
+      if ![string match "" $lines] {
+        verbose "check_v3_target_namedlocale: compilation failed" 2
+        return $et_namedlocale
+      }
+      # else No error message, compilation succeeded.
+    }
+       
+    set result [${tool}_load "./$exe" "$args" ""]
+    set status [lindex $result 0]
+
+    verbose "check_v3_target_namedlocale <$args>: status is <$status>" 2
+
+    if { $status == "pass" } {
+      set et_namedlocale 1
+    }
+    return $et_namedlocale
+}
+
+proc check_v3_target_debug_mode { } {
+    global et_debug_mode
+    global tool        
+
+    if { ![info exists et_debug_mode_target_name] } {
+       set et_debug_mode_target_name ""
     }
 
     # If the target has changed since we set the cached value, clear it.
     set current_target [current_target_name]
-    if { $current_target != $et_namedlocale_target_name } {
-       verbose "check_v3_target_namedlocale: `$et_namedlocale_target_name'" 2
-       set et_namedlocale_target_name $current_target
-       if [info exists et_namedlocale_saved] {
-           verbose "check_v3_target_namedlocale: removing cached result" 2
-           unset et_namedlocale_saved
+    if { $current_target != $et_debug_mode_target_name } {
+       verbose "check_v3_target_debug_mode: `$et_debug_mode_target_name'" 2
+       set et_debug_mode_target_name $current_target
+       if [info exists et_debug_mode] {
+           verbose "check_v3_target_debug_mode: removing cached result" 2
+           unset et_debug_mode
        }
     }
 
-    if [info exists et_namedlocale_saved] {
-       verbose "check_v3_target_namedlocale: using cached result" 2
+    if [info exists et_debug_mode] {
+       verbose "check_v3_target_debug_mode: using cached result" 2
     } else {
-       set et_namedlocale_saved 0
+       set et_debug_mode 0
 
-       # Set up, compile, and execute a C++ test program that tries to use
-       # all the required named locales.
-       set src nlocale[pid].cc
-       set exe nlocale[pid].x
+       # Set up and compile a C++ test program that depends
+       # on debug mode activated.
+       set src debug_mode[pid].cc
+       set exe debug_mode[pid].exe
 
        set f [open $src "w"]
-       puts $f "#include <locale>"
-       puts $f "using namespace std;"  
-       puts $f "int main ()"
-       puts $f "{"
-       puts $f "  try" 
-       puts $f "  {" 
-       puts $f "     locale(\"\");"
-       puts $f "     locale(\"de_DE\");"
-       puts $f "     locale(\"de_DE.ISO-8859-15@euro\");"
-       puts $f "     locale(\"de_DE@euro\");"
-       puts $f "     locale(\"en_HK\");"
-       puts $f "     locale(\"en_PH\");"
-       puts $f "     locale(\"en_US\");"
-       puts $f "     locale(\"en_US.ISO-8859-1\");"
-       puts $f "     locale(\"en_US.ISO-8859-15\");"
-       puts $f "     locale(\"en_US.UTF-8\");"
-       puts $f "     locale(\"es_ES\");"
-       puts $f "     locale(\"es_MX\");"
-       puts $f "     locale(\"fr_FR\");"
-       puts $f "     locale(\"fr_FR@euro\");"
-       puts $f "     locale(\"is_IS\");"
-       puts $f "     locale(\"is_IS.UTF-8\");"
-       puts $f "     locale(\"it_IT\");"
-       puts $f "     locale(\"ja_JP.eucjp\");"
-       puts $f "     locale(\"se_NO.UTF-8\");"
-       puts $f "     locale(\"ta_IN\");"
-       puts $f "     locale(\"zh_TW\");"
-       puts $f "     return 0;"
-       puts $f "  }"
-       puts $f "  catch(...)"
-       puts $f "  {"
-       puts $f "     return 1;"
-       puts $f "  }"   
-       puts $f "}"
+       puts $f "#include <string>"
+       puts $f "#ifndef _GLIBCXX_DEBUG"
+       puts $f "#  error No debug mode"
+       puts $f "#endif"
+       puts $f "int main()"
+       puts $f "{ return 0; }"
        close $f
 
        set lines [v3_target_compile $src $exe executable ""]
@@ -817,70 +926,511 @@ proc check_v3_target_namedlocale { } {
 
        if [string match "" $lines] {
            # No error message, compilation succeeded.
-           set result [${tool}_load "./$exe" "" ""]
-           set status [lindex $result 0]
-           remote_file build delete $exe
+           set et_debug_mode 1
+       }
+    }
+    verbose "check_v3_target_debug_mode: $et_debug_mode" 2
+    return $et_debug_mode
+}
 
-           verbose "check_v3_target_namedlocale: status is <$status>" 2
+proc check_v3_target_parallel_mode { } {
+    global cxxflags
+    global v3-libgomp
+    global et_parallel_mode
 
-           if { $status == "pass" } {
-               set et_namedlocale_saved 1
-           }
+    global tool        
+
+    if { ![info exists et_parallel_mode_target_name] } {
+       set et_parallel_mode_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_parallel_mode_target_name } {
+       verbose "check_v3_target_parallel_mode: `$et_parallel_mode_target_name'" 2
+       set et_parallel_mode_target_name $current_target
+       if [info exists et_parallel_mode] {
+           verbose "check_v3_target_parallel_mode: removing cached result" 2
+           unset et_parallel_mode
+       }
+    }
+
+    if [info exists et_parallel_mode] {
+       verbose "check_v3_target_parallel_mode: using cached result" 2
+    } else {
+       set et_parallel_mode 0
+
+       # If 'make check-parallel' is running the test succeeds.
+       if { ${v3-libgomp} == 1 && [regexp "libgomp" $cxxflags] } {
+           set et_parallel_mode 1
+       }
+    }
+    verbose "check_v3_target_parallel_mode: $et_parallel_mode" 2
+    return $et_parallel_mode
+}
+
+proc check_v3_target_cstdint { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_cstdint
+
+    global tool        
+
+    if { ![info exists et_cstdint_target_name] } {
+       set et_cstdint_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_cstdint_target_name } {
+       verbose "check_v3_target_cstdint: `$et_cstdint_target_name'" 2
+       set et_cstdint_target_name $current_target
+       if [info exists et_cstdint] {
+           verbose "check_v3_target_cstdint: removing cached result" 2
+           unset et_cstdint
+       }
+    }
+
+    if [info exists et_cstdint] {
+       verbose "check_v3_target_cstdint: using cached result" 2
+    } else {
+       set et_cstdint 0
+
+       # Set up and compile a C++0x test program that depends
+       # on the C99 stdint facilities to be available.
+       set src cstdint[pid].cc
+       set exe cstdint[pid].exe
+
+       set f [open $src "w"]
+       puts $f "#include <tr1/cstdint>"
+       puts $f "int main()"
+       puts $f "#ifdef _GLIBCXX_USE_C99_STDINT_TR1"
+       puts $f "{ return 0; }"
+       puts $f "#endif"
+       close $f
+
+       set cxxflags_saved $cxxflags
+       set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+       set lines [v3_target_compile $src $exe executable ""]
+       set cxxflags $cxxflags_saved
+       file delete $src
+
+       if [string match "" $lines] {
+           # No error message, compilation succeeded.
+           set et_cstdint 1
        } else {
-           verbose "check_v3_target_namedlocale: compilation failed" 2
+           verbose "check_v3_target_cstdint: compilation failed" 2
        }
     }
-    return $et_namedlocale_saved
+    verbose "check_v3_target_cstdint: $et_cstdint" 2
+    return $et_cstdint
 }
 
-proc check_v3_target_debug_mode { } {
+proc check_v3_target_atomic_builtins { } {
     global cxxflags
-    global et_debug_mode
+    global DEFAULT_CXXFLAGS
+    global et_cstdint
+
     global tool        
 
-    if { ![info exists et_debug_mode_target_name] } {
-       set et_debug_mode_target_name ""
+    if { ![info exists et_atomic_builtins_target_name] } {
+       set et_atomic_builtins_target_name ""
     }
 
     # If the target has changed since we set the cached value, clear it.
     set current_target [current_target_name]
-    if { $current_target != $et_debug_mode_target_name } {
-       verbose "check_v3_target_debug_mode: `$et_debug_mode_target_name'" 2
-       set et_debug_mode_target_name $current_target
-       if [info exists et_debug_mode] {
-           verbose "check_v3_target_debug_mode: removing cached result" 2
-           unset et_debug_mode
+    if { $current_target != $et_atomic_builtins_target_name } {
+       verbose "check_v3_target_atomic_builtins: `$et_atomic_builtins_target_name'" 2
+       set et_atomic_builtins_target_name $current_target
+       if [info exists et_atomic_builtins] {
+           verbose "check_v3_target_atomic_builtins: removing cached result" 2
+           unset et_atomic_builtins
        }
     }
 
-    if [info exists et_debug_mode] {
-       verbose "check_v3_target_debug_mode: using cached result" 2
+    if [info exists et_atomic_builtins] {
+       verbose "check_v3_target_atomic_builtins: using cached result" 2
     } else {
-       set et_debug_mode 0
+       set et_atomic_builtins 0
 
-       # Set up, compile, and execute a C++ test program that depends
-       # on debug mode working.
-       set src debug_mode[pid].cc
-       set exe debug_mode[pid].exe
+       # Set up and compile a C++0x test program that depends
+       # on the atomic builtin facilities to be available.
+       set src atomic_builtins[pid].cc
+       set exe atomic_builtins[pid].exe
 
        set f [open $src "w"]
-       puts $f "#include <string>"
-       puts $f "using namespace std;"  
+       puts $f "#include <bits/c++config.h>"
        puts $f "int main()"
+       puts $f "#ifdef _GLIBCXX_ATOMIC_BUILTINS_4"
        puts $f "{ return 0; }"
+       puts $f "#endif"
        close $f
 
        set cxxflags_saved $cxxflags
-       set cxxflags "$cxxflags -Werror -O0 -D_GLIBCXX_DEBUG"
+       set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
        set lines [v3_target_compile $src $exe executable ""]
        set cxxflags $cxxflags_saved
        file delete $src
 
        if [string match "" $lines] {
            # No error message, compilation succeeded.
-           set et_debug_mode 1
+           set et_atomic_builtins 1
+       } else {
+           verbose "check_v3_target_atomic_builtins: compilation failed" 2
        }
     }
-    verbose "check_v3_target_debug_mode: $et_debug_mode" 2
-    return $et_debug_mode
+    verbose "check_v3_target_atomic_builtins: $et_atomic_builtins" 2
+    return $et_atomic_builtins
 }
+
+proc check_v3_target_gthreads { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_gthreads
+
+    global tool
+
+    if { ![info exists et_gthreads_target_name] } {
+        set et_gthreads_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_gthreads_target_name } {
+        verbose "check_v3_target_gthreads: `$et_gthreads_target_name'" 2
+        set et_gthreads_target_name $current_target
+        if [info exists et_gthreads] {
+            verbose "check_v3_target_gthreads: removing cached result" 2
+            unset et_gthreads
+        }
+    }
+
+    if [info exists et_gthreads] {
+        verbose "check_v3_target_gthreads: using cached result" 2
+    } else {
+        set et_gthreads 0
+
+        # Set up and compile a C++0x test program that depends
+        # on the gthreads facilities to be available.
+        set src gthreads[pid].cc
+        set exe gthreads[pid].exe
+
+        set f [open $src "w"]
+       puts $f "#include <bits/c++config.h>"
+        puts $f "int main()"
+        puts $f "#ifdef _GLIBCXX_HAS_GTHREADS"
+        puts $f "{ return 0; }"
+        puts $f "#endif"
+        close $f
+
+        set cxxflags_saved $cxxflags
+        set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+        set lines [v3_target_compile $src $exe executable ""]
+        set cxxflags $cxxflags_saved
+        file delete $src
+
+        if [string match "" $lines] {
+            # No error message, compilation succeeded.
+            set et_gthreads 1
+        } else {
+            verbose "check_v3_target_gthreads: compilation failed" 2
+        }
+    }
+    verbose "check_v3_target_gthreads: $et_gthreads" 2
+    return $et_gthreads
+}
+
+proc check_v3_target_nanosleep { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_nanosleep
+
+    global tool
+
+    if { ![info exists et_nanosleep_target_name] } {
+        set et_nanosleep_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_nanosleep_target_name } {
+        verbose "check_v3_target_nanosleep: `$et_nanosleep_target_name'" 2
+        set et_nanosleep_target_name $current_target
+        if [info exists et_nanosleep] {
+            verbose "check_v3_target_nanosleep: removing cached result" 2
+            unset et_nanosleep
+        }
+    }
+
+    if [info exists et_nanosleep] {
+        verbose "check_v3_target_nanosleep: using cached result" 2
+    } else {
+        set et_nanosleep 0
+       
+       # Set up and compile a C++0x test program that depends
+        # on the nanosleep facilities to be available.
+        set src nanosleep[pid].cc
+        set exe nanosleep[pid].exe
+
+        set f [open $src "w"]
+        puts $f "#include <bits/c++config.h>"
+        puts $f "int main()"
+        puts $f "#ifdef _GLIBCXX_USE_NANOSLEEP"
+        puts $f "{ return 0; }"
+        puts $f "#endif"
+        close $f
+
+        set cxxflags_saved $cxxflags
+        set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+        set lines [v3_target_compile $src $exe executable ""]
+        set cxxflags $cxxflags_saved
+        file delete $src
+
+        if [string match "" $lines] {
+            # No error message, compilation succeeded.
+            set et_nanosleep 1
+        } else {
+            verbose "check_v3_target_nanosleep: compilation failed" 2
+        }
+    }
+    verbose "check_v3_target_nanosleep: $et_nanosleep" 2
+    return $et_nanosleep
+}
+
+proc check_v3_target_sched_yield { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_sched_yield
+
+    global tool
+
+    if { ![info exists et_sched_yield_target_name] } {
+        set et_sched_yield_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_sched_yield_target_name } {
+        verbose "check_v3_target_sched_yield: `$et_sched_yield_target_name'" 2
+        set et_sched_yield_target_name $current_target
+        if [info exists et_sched_yield] {
+            verbose "check_v3_target_sched_yield: removing cached result" 2
+            unset et_sched_yield
+        }
+    }
+
+    if [info exists et_sched_yield] {
+        verbose "check_v3_target_sched_yield: using cached result" 2
+    } else {
+        set et_sched_yield 0
+
+        # Set up and compile a C++0x test program that depends
+        # on the sched_yield facility to be available.
+        set src sched_yield[pid].cc
+        set exe sched_yield[pid].exe
+
+        set f [open $src "w"]
+        puts $f "#include <bits/c++config.h>"
+        puts $f "int main()"
+        puts $f "#ifdef _GLIBCXX_USE_SCHED_YIELD"
+        puts $f "{ return 0; }"
+        puts $f "#endif"
+        close $f
+
+        set cxxflags_saved $cxxflags
+        set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+        set lines [v3_target_compile $src $exe executable ""]
+        set cxxflags $cxxflags_saved
+        file delete $src
+
+        if [string match "" $lines] {
+            # No error message, compilation succeeded.
+            set et_sched_yield 1
+        } else {
+            verbose "check_v3_target_sched_yield: compilation failed" 2
+        }
+    }
+    verbose "check_v3_target_sched_yield: $et_sched_yield" 2
+    return $et_sched_yield
+}
+
+proc check_v3_target_string_conversions { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_string_conversions
+
+    global tool
+
+    if { ![info exists et_string_conversions_target_name] } {
+        set et_string_conversions_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_string_conversions_target_name } {
+        verbose "check_v3_target_string_conversions: `$et_string_conversions_target_name'" 2
+        set et_string_conversions_target_name $current_target
+        if [info exists et_string_conversions] {
+            verbose "check_v3_target_string_conversions: removing cached result" 2
+            unset et_string_conversions
+        }
+    }
+
+    if [info exists et_string_conversions] {
+        verbose "check_v3_target_string_conversions: using cached result" 2
+    } else {
+        set et_string_conversions 0
+       
+       # Set up and compile a C++0x test program that depends
+        # on the string_conversions facilities to be available.
+        set src string_conversions[pid].cc
+        set exe string_conversions[pid].exe
+
+        set f [open $src "w"]
+        puts $f "#include <bits/c++config.h>"
+        puts $f "int main()"
+        puts $f "#if defined(_GLIBCXX_USE_C99) && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)"
+        puts $f "{ return 0; }"
+        puts $f "#endif"
+        close $f
+
+        set cxxflags_saved $cxxflags
+        set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+        set lines [v3_target_compile $src $exe executable ""]
+        set cxxflags $cxxflags_saved
+        file delete $src
+
+        if [string match "" $lines] {
+            # No error message, compilation succeeded.
+            set et_string_conversions 1
+        } else {
+            verbose "check_v3_target_string_conversions: compilation failed" 2
+        }
+    }
+    verbose "check_v3_target_string_conversions: $et_string_conversions" 2
+    return $et_string_conversions
+}
+
+proc check_v3_target_swprintf { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_swprintf
+
+    global tool
+
+    if { ![info exists et_swprintf_target_name] } {
+        set et_swprintf_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_swprintf_target_name } {
+        verbose "check_v3_target_swprintf: `$et_swprintf_target_name'" 2
+        set et_swprintf_target_name $current_target
+        if [info exists et_swprintf] {
+            verbose "check_v3_target_swprintf: removing cached result" 2
+            unset et_swprintf
+        }
+    }
+
+    if [info exists et_swprintf] {
+        verbose "check_v3_target_swprintf: using cached result" 2
+    } else {
+        set et_swprintf 0
+       
+       # Set up and compile a C++0x test program that depends
+        # on a standard swprintf function to be available.
+        set src swprintf[pid].cc
+        set exe swprintf[pid].exe
+
+        set f [open $src "w"]
+        puts $f "#include <bits/c++config.h>"
+        puts $f "int main()"
+        puts $f "#if !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)"
+        puts $f "{ return 0; }"
+        puts $f "#endif"
+        close $f
+
+        set cxxflags_saved $cxxflags
+        set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+        set lines [v3_target_compile $src $exe executable ""]
+        set cxxflags $cxxflags_saved
+        file delete $src
+
+        if [string match "" $lines] {
+            # No error message, compilation succeeded.
+            set et_swprintf 1
+        } else {
+            verbose "check_v3_target_swprintf: compilation failed" 2
+        }
+    }
+    verbose "check_v3_target_swprintf: $et_swprintf" 2
+    return $et_swprintf
+}
+
+proc check_v3_target_binary_io { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_binary_io
+
+    global tool
+
+    if { ![info exists et_binary_io_target_name] } {
+        set et_binary_io_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_binary_io_target_name } {
+        verbose "check_v3_target_binary_io: `$et_binary_io_target_name'" 2
+        set et_binary_io_target_name $current_target
+        if [info exists et_binary_io] {
+            verbose "check_v3_target_binary_io: removing cached result" 2
+            unset et_binary_io
+        }
+    }
+
+    if [info exists et_binary_io] {
+        verbose "check_v3_target_binary_io: using cached result" 2
+    } else {
+        set et_binary_io 0
+       
+       # Set up and compile a C++0x test program that depends
+        # on text and binary I/O being the same.
+        set src binary_io[pid].cc
+        set exe binary_io[pid].exe
+
+        set f [open $src "w"]
+        puts $f "#include <bits/c++config.h>"
+        puts $f "int main()"
+        puts $f "#if !defined(_GLIBCXX_HAVE_DOS_BASED_FILESYSTEM)"
+        puts $f "{ return 0; }"
+        puts $f "#endif"
+        close $f
+
+        set cxxflags_saved $cxxflags
+        set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+        set lines [v3_target_compile $src $exe executable ""]
+        set cxxflags $cxxflags_saved
+        file delete $src
+
+        if [string match "" $lines] {
+            # No error message, compilation succeeded.
+            set et_binary_io 1
+        } else {
+            verbose "check_v3_target_binary_io: compilation failed" 2
+        }
+    }
+    verbose "check_v3_target_binary_io: $et_binary_io" 2
+    return $et_binary_io
+}
+
+set additional_prunes ""