1 # Copyright
(C
) 2014-2017 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
3 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC
; see the file COPYING3.
If not see
15 #
<http
://www.gnu.org
/licenses
/>.
18 # cilkplus_link_flags
-- compute library path and flags to find libcilkrts.
19 #
(originally from g
++.exp
)
22 proc cilkplus_link_flags
{ paths
} {
24 global ld_library_path
30 set shlib_ext
[get_shlib_extension
]
32 if { $gccpath
!= "" } {
33 if { [file
exists "${gccpath}/libcilkrts/.libs/libcilkrts.a"]
34 ||
[file
exists "${gccpath}/libcilkrts/.libs/libcilkrts.${shlib_ext}"] } {
35 append flags
" -B${gccpath}/libcilkrts/ "
36 append flags
" -L${gccpath}/libcilkrts/.libs"
37 append ld_library_path
":${gccpath}/libcilkrts/.libs"
42 set libcilkrts
[lookfor_file $
{tool_root_dir
} libcilkrts
]
43 if { $libcilkrts
!= "" } {
44 append flags
"-L${libcilkrts} "
45 append ld_library_path
":${libcilkrts}"
49 set_ld_library_path_env_vars
55 # cilkplus_init
-- called at the start of each subdir of tests
58 proc cilkplus_init
{ args } {
59 global TEST_ALWAYS_FLAGS
60 global ALWAYS_CXXFLAGS
62 global cilkplus_saved_TEST_ALWAYS_FLAGS
65 if ![is_remote host
] {
66 if [info exists TOOL_OPTIONS
] {
67 set link_flags
"[cilkplus_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
69 set link_flags
"[cilkplus_link_flags [get_multilibs]]"
73 if [info exists TEST_ALWAYS_FLAGS
] {
74 set cilkplus_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
76 if [info exists ALWAYS_CXXFLAGS
] {
77 set ALWAYS_CXXFLAGS
[concat
"{ldflags=$link_flags}" $ALWAYS_CXXFLAGS]
79 if [info exists TEST_ALWAYS_FLAGS
] {
80 set TEST_ALWAYS_FLAGS
"$link_flags $TEST_ALWAYS_FLAGS"
82 set TEST_ALWAYS_FLAGS
"$link_flags"
85 if { $link_flags
!= "" } {
92 # cilkplus_finish
-- called at the end of each subdir of tests
95 proc cilkplus_finish
{ args } {
96 global TEST_ALWAYS_FLAGS
97 global cilkplus_saved_TEST_ALWAYS_FLAGS
99 if [info exists cilkplus_saved_TEST_ALWAYS_FLAGS
] {
100 set TEST_ALWAYS_FLAGS $cilkplus_saved_TEST_ALWAYS_FLAGS
102 unset TEST_ALWAYS_FLAGS
104 clear_effective_target_cache