diff options
author | Jim Blandy <jimb@codesourcery.com> | 2002-08-29 22:36:52 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2002-08-29 22:36:52 +0000 |
commit | b6ff0e81ff1a74f6471c6a731334adca46e7d956 (patch) | |
tree | f2dcd08a4007a9f7e28ddefe2ee00f64d8d5fb7a /gdb/testsuite/lib | |
parent | 66609862575ac6e46dc1040bd9e58b3153a1355e (diff) | |
download | gdb-b6ff0e81ff1a74f6471c6a731334adca46e7d956.zip gdb-b6ff0e81ff1a74f6471c6a731334adca46e7d956.tar.gz gdb-b6ff0e81ff1a74f6471c6a731334adca46e7d956.tar.bz2 |
* gdb.threads/pthreads.exp: Move the portable thread compilation
code into a function in lib/gdb.exp, and call that from here.
* lib/gdb.exp (gdb_compile_pthreads): New function.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index b4a0b8a..8949910 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1171,6 +1171,42 @@ proc gdb_compile {source dest type options} { return $result; } + +# This is just like gdb_compile, above, except that it tries compiling +# against several different thread libraries, to see which one this +# system has. +proc gdb_compile_pthreads {source dest type options} { + set build_binfile 0 + set why_msg "unrecognized error" + foreach lib {-lpthreads -lpthread -lthread} { + # This kind of wipes out whatever libs the caller may have + # set. Or maybe theirs will override ours. How infelicitous. + set options_with_lib [concat $options [list libs=$lib]] + set ccout [gdb_compile $source $dest $type $options_with_lib] + switch -regexp -- $ccout { + ".*no posix threads support.*" { + set why_msg "missing threads include file" + break + } + ".*cannot open -lpthread.*" { + set why_msg "missing runtime threads library" + } + ".*Can't find library for -lpthread.*" { + set why_msg "missing runtime threads library" + } + {^$} { + pass "successfully compiled posix threads test case" + set built_binfile 1 + break + } + } + } + if {$built_binfile == "0"} { + unsupported "Couldn't compile $source: ${why_msg}" + return -1 + } +} + proc send_gdb { string } { global suppress_flag; if { $suppress_flag } { |