1 # libstdc++ "tool init file" for DejaGNU
3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 # Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 # Define callbacks and load other libraries. This file is loaded relatively
23 # early, and before any other file we write ourselves. "load_lib" will
24 # find anything in the DejaGNU installation tree, or in our lib directory.
25 # "load_gcc_lib" will search the core compiler's .exp collection instead.
27 # The naming rule is that dg.exp looks for "tool-" and runtest.exp looks
28 # for "tool_" when finding callbacks. Utility routines we define for
29 # our callbacks begin with "v3-".
31 # libstdc++_* callbacks we don't define, but could:
32 # ..._option_help prints additional --help output
33 # ..._option_proc (--foo) process our own options
34 # ..._init (normal.exp) called once per test file
35 # ..._finish bracketing function for libstdc++_init
36 # ...-dg-prune removing output text, see top of system dg.exp
38 # Useful hook: if ${hostname}_init exists, it will be called, almost
39 # the last thing before testing begins. This can be defined in, e.g.,
40 # ~/.dejagnurc or $DEJAGNU.
42 proc load_gcc_lib { filename } {
44 load_file $srcdir/../../gcc/testsuite/lib/$filename
50 # compiler routines, then ours
51 load_gcc_lib target-supports.exp
52 load_gcc_lib target-supports-dg.exp
54 load_lib dg-options.exp
55 load_gcc_lib target-libpath.exp
56 load_gcc_lib wrapper.exp
58 # Useful for debugging. Pass the name of a variable and the verbosity
59 # threshold (number of -v's on the command line).
60 proc v3track { var n } {
62 verbose "++ $var is $val" $n
65 # Called by v3-init below. "Static" to this file.
66 proc v3-copy-files {srcfiles} {
68 if { [catch { set symlink [file readlink $f] } x] } then {
69 remote_download target $f
71 if { [regexp "^/" "$symlink"] } then {
72 remote_download target $symlink
74 set dirname [file dirname $f]
75 remote_download target $dirname/$symlink
81 # Called once, during runtest.exp setup.
82 proc libstdc++_init { testfile } {
85 global srcdir blddir objdir tool_root_dir
86 global cc cxx cxxflags cxxldflags
88 global gluefile wrap_flags
89 global ld_library_path
93 # We set LC_ALL and LANG to C so that we get the same error
94 # messages as expected.
98 set blddir [lookfor_file [get_multilibs] libstdc++-v3]
99 set flags_file "${blddir}/scripts/testsuite_flags"
102 # If a test doesn't have special options, use DEFAULT_CXXFLAGS.
103 # Use this variable if the behavior
104 # 1) only applies to libstdc++ testing
105 # 2) might need to be negated
106 # In particular, some tests have to be run without precompiled
107 # headers, or without assertions.
108 global DEFAULT_CXXFLAGS
109 if ![info exists DEFAULT_CXXFLAGS] then {
110 set DEFAULT_CXXFLAGS ""
111 # Host specific goo here.
112 if { [string match "powerpc-*-darwin*" $target_triplet] } {
113 append DEFAULT_CXXFLAGS " -multiply_defined suppress"
116 v3track DEFAULT_CXXFLAGS 2
118 # By default, we assume we want to run program images.
119 global dg-do-what-default
120 set dg-do-what-default run
122 # Copy any required data files.
123 v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"]
124 v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"]
126 # Locate libgcc.a so we don't need to account for different values of
127 # SHLIB_EXT on different platforms
128 set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
130 set gccdir [file dirname $gccdir]
134 # Look for shared library. (ie libstdc++.so.)
136 set sharedlibdir [lookfor_file $blddir src/.libs/libstdc++.so]
137 if {$sharedlibdir != ""} {
138 if { [string match "*-*-linux*" $target_triplet] && [isnative] } {
140 verbose -log "shared library support detected"
143 v3track v3-sharedlib 3
145 # Compute what needs to be added to the existing LD_LIBRARY_PATH.
147 set ld_library_path ""
148 append ld_library_path ":${gccdir}"
149 set compiler ${gccdir}/g++
150 append ld_library_path ":${blddir}/src/.libs"
152 if { [is_remote host] == 0 && [which $compiler] != 0 } {
153 foreach i "[exec $compiler --print-multi-lib]" {
155 regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
156 set mldir [string trimright $mldir "\;@"]
157 if { "$mldir" == "." } {
160 if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
161 append ld_library_path ":${gccdir}/${mldir}"
166 set_ld_library_path_env_vars
167 if [info exists env(LD_LIBRARY_PATH)] {
168 verbose -log "LD_LIBRARY_PATH = $env(LD_LIBRARY_PATH)"
171 set compiler [transform "g++"]
175 set cxx [transform "g++"]
176 set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0"
178 set cc [transform "gcc"]
179 # Locate testsuite_hooks.h and other testsuite headers.
180 set includes "-I${srcdir}/util"
181 # Adapt the defaults for special circumstances.
182 if [is_remote host] {
183 # A remote host does not, in general, have access to the
184 # $srcdir so we copy the testsuite headers into the current
185 # directory, and then add that to the search path.
186 foreach src [glob "${srcdir}/util/*.h" \
187 "${srcdir}/util/*.cc" \
188 "${srcdir}/util/*/*.hpp" \
189 "${srcdir}/util/*/*.cc" \
190 "${srcdir}/util/*/*.hpp" \
191 "${srcdir}/util/*/*/*.cc" \
192 "${srcdir}/util/*/*/*.hpp" \
193 "${srcdir}/util/*/*/*/*.cc" \
194 "${srcdir}/util/*/*/*/*.hpp" \
195 "${srcdir}/util/*/*/*/*/*.cc" \
196 "${srcdir}/util/*/*/*/*/*.hpp" ] {
197 # Remove everything up to "util/..."
198 set dst [string range $src [string length "${srcdir}/"] end]
199 # Create the directory containing the file.
200 set dir [file dirname $dst]
201 remote_exec host "mkdir" [list "-p" "$dir"]
203 set result [remote_download host $src $dst]
204 if { $result == "" } {
205 verbose -log "Unable to download ${srcdir}/${src} to host."
209 set includes "-Iutil"
210 } elseif { [file exists $flags_file] } {
211 # If we find a testsuite_flags file, we're testing in the build dir.
212 set cxx [exec sh $flags_file --build-cxx]
213 set cxxflags [exec sh $flags_file --cxxflags]
214 set cxxldflags [exec sh $flags_file --cxxldflags]
215 set cc [exec sh $flags_file --build-cc]
216 set includes [exec sh $flags_file --build-includes]
219 # Always use MO files built by this test harness.
220 set cxxflags "$cxxflags -DLOCALEDIR=\".\""
221 set ccflags "$cxxflags -DLOCALEDIR=\".\""
223 # If a PCH file is available, use it. We must delay performing
224 # this check until $cxx and such have been initialized because we
225 # perform a test compilation. (Ideally, gcc --print-file-name would
226 # list PCH files, but it does not.)
228 if ![info exists PCH_CXXFLAGS] then {
229 set src "config[pid].cc"
230 set f [open $src "w"]
231 puts $f "int main () {}"
234 set lines [v3_target_compile $src "config[pid].o" object \
235 "additional_flags=-include additional_flags=bits/stdtr1c++.h"]
237 # set PCH_CXXFLAGS "-include bits/extc++.h"
238 # set PCH_CXXFLAGS "-include bits/stdtr1c++.h"
239 set PCH_CXXFLAGS "-include bits/stdc++.h"
244 v3track PCH_CXXFLAGS 2
247 libstdc++_maybe_build_wrapper "${objdir}/testglue.o" "-fexceptions"
250 # Callback for cleanup routines.
251 proc libstdc++_exit { } {
254 if [info exists gluefile] {
255 file_on_build delete $gluefile;
260 # Callback from system dg-test.
261 proc libstdc++-dg-test { prog do_what extra_tool_flags } {
262 # Set up the compiler flags, based on what we're going to do.
265 set compile_type "preprocess"
266 set output_file "[file rootname [file tail $prog]].i"
269 set compile_type "assembly"
270 set output_file "[file rootname [file tail $prog]].s"
273 set compile_type "object"
274 set output_file "[file rootname [file tail $prog]].o"
277 set compile_type "executable"
278 set output_file "./[file rootname [file tail $prog]].exe"
281 set compile_type "executable"
282 # FIXME: "./" is to cope with "." not being in $PATH.
283 # Should this be handled elsewhere?
285 set output_file "./[file rootname [file tail $prog]].exe"
286 # This is the only place where we care if an executable was
287 # created or not. If it was, dg.exp will try to run it.
288 catch { remote_file build delete $output_file }
291 perror "$do_what: not a valid dg-do keyword"
296 # Short-circut a bunch of complicated goo here for the special
297 # case of compiling a test file as a "C" file, not as C++. Why? So
298 # -nostdc++ doesn't trip us up. So all the extra object files
299 # don't trip us up. So automatically linking in libstdc++ doesn't
300 # happen. So CXXFLAGS don't error.
301 set select_compile "v3_target_compile"
303 if { $extra_tool_flags != "" } {
304 verbose -log "extra_tool_flags are:"
305 verbose -log $extra_tool_flags
306 if { [string first "-x c" $extra_tool_flags ] != -1 } {
307 verbose -log "compiling and executing as C, not C++"
308 set edit_tool_flags $extra_tool_flags
309 regsub -all ".x c" $edit_tool_flags "" edit_tool_flags
310 lappend options "additional_flags=$edit_tool_flags"
311 set select_compile "v3_target_compile_as_c"
313 lappend options "additional_flags=$extra_tool_flags"
317 # There is a libstdc++_compile made for us by default (via the tool-
318 # and-target file), but the defaults are lacking in goodness.
319 set comp_output [$select_compile "$prog" "$output_file" "$compile_type" $options];
320 set comp_output [ prune_g++_output $comp_output ];
322 return [list $comp_output $output_file]
325 # True if the library supports wchar_t.
328 # True if the library supports threads.
331 # True if the library supports symbol versioning.
334 # Called from libstdc++-dg-test above. Calls back into system's
335 # target_compile to actually do the work.
336 proc v3_target_compile { source dest type options } {
344 if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
345 lappend options "libs=${gluefile}"
346 lappend options "ldflags=${wrap_flags}"
350 set cxxlibglossflags [libgloss_link_flags]
351 set cxx_final [concat $cxx_final $cxxlibglossflags]
352 set cxx_final [concat $cxx_final $cxxflags]
353 set cxx_final [concat $cxx_final $includes]
355 # Flag setting based on type argument.
356 if { $type == "executable" } {
357 # Link the support objects into executables.
358 set cxx_final [concat $cxx_final $cxxldflags]
359 lappend options "additional_flags=./libtestc++.a"
361 if { $type == "sharedlib" } {
362 # Don't link in anything.
363 set type "executable"
367 lappend options "compiler=$cxx_final"
368 lappend options "timeout=600"
370 return [target_compile $source $dest $type $options]
374 # Called from libstdc++-dg-test above, but only for "C" compilation.
375 # Calls back into system's target_compile to actually do the work.
376 proc v3_target_compile_as_c { source dest type options } {
384 if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
385 lappend options "libs=${gluefile}"
386 lappend options "ldflags=${wrap_flags}"
389 set tname [target_info name]
391 set cxxlibglossflags [libgloss_link_flags]
392 set cc_final [concat $cc_final $cxxlibglossflags]
393 set cc_final [concat $cc_final $includes]
394 regsub -all {\s[-]nostdinc[+][+]} $cc_final "" cc_final
396 # This is needed for "C" tests, as this type of test may need the
397 # C++ includes. And if we're not testing in the build directory,
398 # the includes variable is not likely to include the necessary
400 if { ![file exists $flags_file] } {
401 # ??? We need a --print-include-dirs option to GCC, so that
402 # we can avoid these hacks. The heuristics here will not
403 # work with non-standard --with-includedir= options.
404 set version [remote_exec host ${cc} -dumpversion]
405 # Remove the trailing newline from the output.
406 set version [string trimright [lindex $version 1]]
407 set machine [remote_exec host ${cc} -dumpmachine]
408 set machine [string trimright [lindex $machine 1]]
409 set comp_base_dir [remote_exec host ${cc} --print-prog-name=cc1]
410 set comp_base_dir [lindex $comp_base_dir 1]
411 set comp_base_dir [file dirname [file dirname [file dirname [file dirname [file dirname $comp_base_dir]]]]]
412 # For a cross compiler, the header files will be located in a
413 # machine-specific subdirectory.
414 set crossbase "${comp_base_dir}/${machine}/include/c++/${version}"
415 set crosstarget "${crossbase}/${machine}"
416 set cc_final [concat $cc_final "-I$crossbase -I$crosstarget"]
417 # For a native compiler, the header files will be located at
419 set includesbase "${comp_base_dir}/include/c++/${version}"
420 set includestarget "${includesbase}/${machine}"
421 set cc_final [concat $cc_final "-I$includesbase -I$includestarget"]
423 set libsup "${comp_base_dir}/lib"
425 set libsup "${blddir}/libsupc++/.libs"
428 set cc_final [concat $cc_final "-L$libsup"]
430 lappend options "compiler=$cc_final"
431 lappend options "timeout=600"
433 return [target_compile $source $dest $type $options]
436 # Build the support objects linked in with the libstdc++ tests. In
437 # addition, set v3-wchar_t, v3-threads, and v3-symver appropriately.
438 proc v3-build_support { } {
446 # Figure out whether or not the library supports certain features.
452 set config_src "config.cc"
453 set f [open $config_src "w"]
454 puts $f "#include <bits/c++config.h>"
455 puts $f "#include <bits/gthr.h>"
457 set preprocessed [v3_target_compile $config_src "" \
458 preprocess "additional_flags=-dN"]
459 if { [string first "_GLIBCXX_USE_WCHAR_T" $preprocessed] != -1 } {
460 verbose -log "wchar_t support detected"
463 if { [string first "_GLIBCXX_SYMVER" $preprocessed] != -1 } {
464 verbose -log "symbol versioning support detected"
467 if { [string first "__GTHREADS" $preprocessed] != -1 } {
468 verbose -log "thread support detected"
472 # Try to build the MO files that are used by some of the locale
473 # tests. If we can't build them, that's OK; it just means that
474 # those tests will fail.
475 foreach lang [list "fr" "de"] {
477 file mkdir "$lang/LC_MESSAGES"
478 remote_exec "build" "msgfmt" "-o $lang/LC_MESSAGES/libstdc++.mo $srcdir/../po/$lang.po"
479 if [is_remote host] {
480 remote_exec "host" "mkdir" "-p $lang/LC_MESSAGES"
481 remote_download "host" "$lang/LC_MESSAGES/libstdc++.mo" "$lang/LC_MESSAGES/libstdc++.mo"
486 # Build the support objects.
487 set source_files [list testsuite_abi.cc testsuite_allocator.cc \
488 testsuite_character.cc testsuite_hooks.cc \
489 rng/twister_rand_gen.cc io/verified_cmd_line_input.cc \
490 io/prog_bar.cc performance/time/elapsed_timer.cc ]
491 foreach f $source_files {
492 set obj [file rootname $f].o
493 set object_file [file tail $obj]
494 # Compile with "-w" so that warnings issued by the compiler
495 # do not prevent compilation.
496 if { [v3_target_compile $srcdir/util/$f $object_file "object" \
497 [list "incdir=$srcdir" "additional_flags=-w"]]
499 error "could not compile $f"
501 append libtest_objs "$object_file "
504 # Collect into libtestc++.a
505 if [info exists env(AR_FOR_TARGET)] {
506 set ar $env(AR_FOR_TARGET)
508 set ar [transform "ar"]
510 set arcommand "$ar -rc ./libtestc++.a ${libtest_objs}"
511 verbose -log "$arcommand"
512 set result [lindex [local_exec "$arcommand" "" "" 300] 0]
513 verbose "link result is $result"
514 if { $result == 0 } {
515 if [info exists env(RANLIB_FOR_TARGET)] {
516 set ranlib $env(RANLIB_FOR_TARGET)
518 set ranlib [transform "ranlib"]
520 set ranlibcommand "$ranlib ./libtestc++.a"
521 verbose -log "$ranlibcommand"
522 set result [lindex [local_exec "$ranlibcommand" "" "" 300] 0]
523 if { $result != 0 } {
524 error "could not link libtestc++.a"
528 # Build any shared objects needed for regression testing.
529 if { ${v3-sharedlib} == 1 } {
530 set source_files [list testsuite_shared.cc]
531 foreach f $source_files {
532 set object_file [file rootname $f].so
533 # Compile with "-w" so that warnings issued by the compiler
534 # do not prevent compilation.
535 if { [v3_target_compile $srcdir/util/$f $object_file "sharedlib" \
536 [list "incdir=$srcdir" "additional_flags=-w -shared -fPIC -DPIC"]]
538 error "could not compile $f"
544 proc check_v3_target_fileio { } {
545 global et_fileio_saved
546 global et_fileio_target_name
549 if { ![info exists et_fileio_target_name] } {
550 set et_fileio_target_name ""
553 # If the target has changed since we set the cached value, clear it.
554 set current_target [current_target_name]
555 if { $current_target != $et_fileio_target_name } {
556 verbose "check_v3_target_fileio: `$et_fileio_target_name'" 2
557 set et_fileio_target_name $current_target
558 if [info exists et_fileio_saved] {
559 verbose "check_v3_target_fileio: removing cached result" 2
560 unset et_fileio_saved
564 if [info exists et_fileio_saved] {
565 verbose "check_v3_target_fileio: using cached result" 2
567 set et_fileio_saved 0
569 # Set up, compile, and execute a C++ test program that tries to use
571 set src fileio[pid].cc
572 set exe fileio[pid].x
574 set f [open $src "w"]
575 puts $f "#include <sys/types.h>"
576 puts $f "#include <sys/stat.h>"
577 puts $f "#include <fcntl.h>"
578 puts $f "#include <unistd.h>"
579 puts $f "#include <errno.h>"
580 puts $f "using namespace std;"
581 puts $f "int main ()"
583 puts $f " int fd = open (\".\", O_RDONLY);"
584 puts $f " if (fd == -1)"
586 puts $f " int err = errno;"
587 puts $f " if (err == EIO || err == ENOSYS)"
591 puts $f " close (fd);"
596 set lines [v3_target_compile $src $exe executable ""]
599 if [string match "" $lines] {
600 # No error message, compilation succeeded.
601 set result [${tool}_load "./$exe" "" ""]
602 set status [lindex $result 0]
603 remote_file build delete $exe
605 verbose "check_v3_target_fileio: status is <$status>" 2
607 if { $status == "pass" } {
608 set et_fileio_saved 1
611 verbose "check_v3_target_fileio: compilation failed" 2
614 return $et_fileio_saved
617 # Eventually we want C90/C99 determining and switching from this.
618 proc check_v3_target_c_std { } {
619 global et_c_std_saved
620 global et_c_std_target_name
623 if { ![info exists et_c_std_target_name] } {
624 set et_c_std_target_name ""
627 # If the target has changed since we set the cached value, clear it.
628 set current_target [current_target_name]
629 if { $current_target != $et_c_std_target_name } {
630 verbose "check_v3_target_c_std: `$et_c_std_target_name'" 2
631 set et_c_std_target_name $current_target
632 if [info exists et_c_std_saved] {
633 verbose "check_v3_target_c_std: removing cached result" 2
638 if [info exists et_c_std_saved] {
639 verbose "check_v3_target_c_std: using cached result" 2
643 # Set up, compile, and execute a C++ test program that tries to use
645 # For math bits, could use check_effective_target_c99_math.
646 set src fileio[pid].cc
647 set exe fileio[pid].x
649 set f [open $src "w"]
650 puts $f "#include <tr1/cmath>"
651 puts $f "#include <cstdlib>"
652 puts $f "int main ()"
654 puts $f " float f = 45.55;"
655 puts $f " int i = std::tr1::isnan(f);"
657 puts $f " using std::wctomb;"
662 set lines [v3_target_compile $src $exe executable ""]
665 if [string match "" $lines] {
666 # No error message, compilation succeeded.
667 set result [${tool}_load "./$exe" "" ""]
668 set status [lindex $result 0]
669 remote_file build delete $exe
671 verbose "check_v3_target_c_std: status is <$status>" 2
673 if { $status == "pass" } {
677 verbose "check_v3_target_c_std: compilation failed" 2
680 return $et_c_std_saved
683 proc check_v3_target_sharedlib { } {
685 return ${v3-sharedlib}
688 proc check_v3_target_time { } {
690 global et_time_target_name
693 if { ![info exists et_time_target_name] } {
694 set et_time_target_name ""
697 # If the target has changed since we set the cached value, clear it.
698 set current_target [current_target_name]
699 if { $current_target != $et_time_target_name } {
700 verbose "check_v3_target_time: `$et_time_target_name'" 2
701 set et_time_target_name $current_target
702 if [info exists et_time_saved] {
703 verbose "check_v3_target_time: removing cached result" 2
708 if [info exists et_time_saved] {
709 verbose "check_v3_target_time: using cached result" 2
713 # Set up and compile a C++ test program that tries to use
718 set f [open $src "w"]
719 puts $f "#include <time.h>"
720 puts $f "using namespace std;"
721 puts $f "int main ()"
727 set lines [v3_target_compile $src $exe executable ""]
730 if [string match "" $lines] {
731 # No error message, compilation succeeded.
732 verbose "check_v3_target_time: compilation succeeded" 2
733 remote_file build delete $exe
736 verbose "check_v3_target_time: compilation failed" 2
739 return $et_time_saved
742 proc check_v3_target_namedlocale { } {
743 global et_namedlocale_saved
744 global et_namedlocale_target_name
747 if { ![info exists et_namedlocale_target_name] } {
748 set et_namedlocale_target_name ""
751 # If the target has changed since we set the cached value, clear it.
752 set current_target [current_target_name]
753 if { $current_target != $et_namedlocale_target_name } {
754 verbose "check_v3_target_namedlocale: `$et_namedlocale_target_name'" 2
755 set et_namedlocale_target_name $current_target
756 if [info exists et_namedlocale_saved] {
757 verbose "check_v3_target_namedlocale: removing cached result" 2
758 unset et_namedlocale_saved
762 if [info exists et_namedlocale_saved] {
763 verbose "check_v3_target_namedlocale: using cached result" 2
765 set et_namedlocale_saved 0
767 # Set up, compile, and execute a C++ test program that tries to use
768 # all the required named locales.
769 set src nlocale[pid].cc
770 set exe nlocale[pid].x
772 set f [open $src "w"]
773 puts $f "#include <locale>"
774 puts $f "using namespace std;"
775 puts $f "int main ()"
779 puts $f " locale(\"\");"
780 puts $f " locale(\"de_DE\");"
781 puts $f " locale(\"de_DE.ISO-8859-15@euro\");"
782 puts $f " locale(\"de_DE@euro\");"
783 puts $f " locale(\"en_HK\");"
784 puts $f " locale(\"en_PH\");"
785 puts $f " locale(\"en_US\");"
786 puts $f " locale(\"en_US.ISO-8859-1\");"
787 puts $f " locale(\"en_US.ISO-8859-15\");"
788 puts $f " locale(\"en_US.UTF-8\");"
789 puts $f " locale(\"es_ES\");"
790 puts $f " locale(\"es_MX\");"
791 puts $f " locale(\"fr_FR\");"
792 puts $f " locale(\"fr_FR@euro\");"
793 puts $f " locale(\"is_IS\");"
794 puts $f " locale(\"is_IS.UTF-8\");"
795 puts $f " locale(\"it_IT\");"
796 puts $f " locale(\"ja_JP.eucjp\");"
797 puts $f " locale(\"se_NO.UTF-8\");"
798 puts $f " locale(\"ta_IN\");"
799 puts $f " locale(\"zh_TW\");"
802 puts $f " catch(...)"
809 set lines [v3_target_compile $src $exe executable ""]
812 if [string match "" $lines] {
813 # No error message, compilation succeeded.
814 set result [${tool}_load "./$exe" "" ""]
815 set status [lindex $result 0]
816 remote_file build delete $exe
818 verbose "check_v3_target_namedlocale: status is <$status>" 2
820 if { $status == "pass" } {
821 set et_namedlocale_saved 1
824 verbose "check_v3_target_namedlocale: compilation failed" 2
827 return $et_namedlocale_saved
830 proc check_v3_target_debug_mode { } {
836 if { ![info exists et_debug_mode_target_name] } {
837 set et_debug_mode_target_name ""
840 # If the target has changed since we set the cached value, clear it.
841 set current_target [current_target_name]
842 if { $current_target != $et_debug_mode_target_name } {
843 verbose "check_v3_target_debug_mode: `$et_debug_mode_target_name'" 2
844 set et_debug_mode_target_name $current_target
845 if [info exists et_debug_mode] {
846 verbose "check_v3_target_debug_mode: removing cached result" 2
851 if [info exists et_debug_mode] {
852 verbose "check_v3_target_debug_mode: using cached result" 2
856 # Set up, compile, and execute a C++ test program that depends
857 # on debug mode working.
858 set src debug_mode[pid].cc
859 set exe debug_mode[pid].exe
861 set f [open $src "w"]
862 puts $f "#include <string>"
863 puts $f "using namespace std;"
865 puts $f "{ return 0; }"
868 set cxxflags_saved $cxxflags
869 set cxxflags "$cxxflags -Werror -O0 -D_GLIBCXX_DEBUG"
870 set lines [v3_target_compile $src $exe executable ""]
871 set cxxflags $cxxflags_saved
874 if [string match "" $lines] {
875 # No error message, compilation succeeded.
879 verbose "check_v3_target_debug_mode: $et_debug_mode" 2
880 return $et_debug_mode