]>
Commit | Line | Data |
---|---|---|
aad93da1 | 1 | # Copyright (C) 2014-2017 Free Software Foundation, Inc. |
10b5f23c | 2 | |
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. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
16 | ||
17 | # | |
18 | # cilkplus_link_flags -- compute library path and flags to find libcilkrts. | |
19 | # (originally from g++.exp) | |
20 | # | |
21 | ||
22 | proc cilkplus_link_flags { paths } { | |
23 | global srcdir | |
24 | global ld_library_path | |
25 | global shlib_ext | |
26 | ||
27 | set gccpath ${paths} | |
28 | set flags "" | |
29 | ||
30 | set shlib_ext [get_shlib_extension] | |
31 | ||
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" | |
38 | } | |
39 | } else { | |
40 | global tool_root_dir | |
41 | ||
42 | set libcilkrts [lookfor_file ${tool_root_dir} libcilkrts] | |
43 | if { $libcilkrts != "" } { | |
44 | append flags "-L${libcilkrts} " | |
45 | append ld_library_path ":${libcilkrts}" | |
46 | } | |
47 | } | |
48 | ||
49 | set_ld_library_path_env_vars | |
50 | ||
51 | return "$flags" | |
52 | } | |
53 | ||
54 | # | |
55 | # cilkplus_init -- called at the start of each subdir of tests | |
56 | # | |
57 | ||
58 | proc cilkplus_init { args } { | |
59 | global TEST_ALWAYS_FLAGS | |
60 | global ALWAYS_CXXFLAGS | |
61 | global TOOL_OPTIONS | |
62 | global cilkplus_saved_TEST_ALWAYS_FLAGS | |
63 | ||
64 | set link_flags "" | |
65 | if ![is_remote host] { | |
66 | if [info exists TOOL_OPTIONS] { | |
67 | set link_flags "[cilkplus_link_flags [get_multilibs ${TOOL_OPTIONS}]]" | |
68 | } else { | |
69 | set link_flags "[cilkplus_link_flags [get_multilibs]]" | |
70 | } | |
71 | } | |
72 | ||
73 | if [info exists TEST_ALWAYS_FLAGS] { | |
74 | set cilkplus_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS | |
75 | } | |
76 | if [info exists ALWAYS_CXXFLAGS] { | |
77 | set ALWAYS_CXXFLAGS [concat "{ldflags=$link_flags}" $ALWAYS_CXXFLAGS] | |
78 | } else { | |
79 | if [info exists TEST_ALWAYS_FLAGS] { | |
80 | set TEST_ALWAYS_FLAGS "$link_flags $TEST_ALWAYS_FLAGS" | |
81 | } else { | |
82 | set TEST_ALWAYS_FLAGS "$link_flags" | |
83 | } | |
84 | } | |
85 | if { $link_flags != "" } { | |
86 | return 1 | |
87 | } | |
88 | return 0 | |
89 | } | |
90 | ||
91 | # | |
92 | # cilkplus_finish -- called at the end of each subdir of tests | |
93 | # | |
94 | ||
95 | proc cilkplus_finish { args } { | |
96 | global TEST_ALWAYS_FLAGS | |
97 | global cilkplus_saved_TEST_ALWAYS_FLAGS | |
98 | ||
99 | if [info exists cilkplus_saved_TEST_ALWAYS_FLAGS] { | |
100 | set TEST_ALWAYS_FLAGS $cilkplus_saved_TEST_ALWAYS_FLAGS | |
101 | } else { | |
102 | unset TEST_ALWAYS_FLAGS | |
103 | } | |
b1b2caa1 | 104 | clear_effective_target_cache |
10b5f23c | 105 | } |