OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [lib/] [target-libpath.exp] - Blame information for rev 455

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
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
# .
16
 
17
# This file was contributed by John David Anglin (dave.anglin@nrc-cnrc.gc.ca)
18
 
19
set orig_environment_saved 0
20
set orig_ld_library_path_saved 0
21
set orig_ld_run_path_saved 0
22
set orig_shlib_path_saved 0
23
set orig_ld_libraryn32_path_saved 0
24
set orig_ld_library64_path_saved 0
25
set orig_ld_library_path_32_saved 0
26
set orig_ld_library_path_64_saved 0
27
set orig_dyld_library_path_saved 0
28
 
29
 
30
#######################################
31
# proc set_ld_library_path_env_vars { }
32
#######################################
33
 
34
proc set_ld_library_path_env_vars { } {
35
  global ld_library_path
36
  global orig_environment_saved
37
  global orig_ld_library_path_saved
38
  global orig_ld_run_path_saved
39
  global orig_shlib_path_saved
40
  global orig_ld_libraryn32_path_saved
41
  global orig_ld_library64_path_saved
42
  global orig_ld_library_path_32_saved
43
  global orig_ld_library_path_64_saved
44
  global orig_dyld_library_path_saved
45
  global orig_ld_library_path
46
  global orig_ld_run_path
47
  global orig_shlib_path
48
  global orig_ld_libraryn32_path
49
  global orig_ld_library64_path
50
  global orig_ld_library_path_32
51
  global orig_ld_library_path_64
52
  global orig_dyld_library_path
53
 
54
  # Setting the ld library path causes trouble when testing cross-compilers.
55
  if { [is_remote target] } {
56
    return
57
  }
58
 
59
  if { $orig_environment_saved == 0 } {
60
    global env
61
 
62
    set orig_environment_saved 1
63
 
64
    # Save the original environment.
65
    if [info exists env(LD_LIBRARY_PATH)] {
66
      set orig_ld_library_path "$env(LD_LIBRARY_PATH)"
67
      set orig_ld_library_path_saved 1
68
    }
69
    if [info exists env(LD_RUN_PATH)] {
70
      set orig_ld_run_path "$env(LD_RUN_PATH)"
71
      set orig_ld_run_path_saved 1
72
    }
73
    if [info exists env(SHLIB_PATH)] {
74
      set orig_shlib_path "$env(SHLIB_PATH)"
75
      set orig_shlib_path_saved 1
76
    }
77
    if [info exists env(LD_LIBRARYN32_PATH)] {
78
      set orig_ld_libraryn32_path "$env(LD_LIBRARYN32_PATH)"
79
      set orig_ld_libraryn32_path_saved 1
80
    }
81
    if [info exists env(LD_LIBRARY64_PATH)] {
82
      set orig_ld_library64_path "$env(LD_LIBRARY64_PATH)"
83
      set orig_ld_library64_path_saved 1
84
    }
85
    if [info exists env(LD_LIBRARY_PATH_32)] {
86
      set orig_ld_library_path_32 "$env(LD_LIBRARY_PATH_32)"
87
      set orig_ld_library_path_32_saved 1
88
    }
89
    if [info exists env(LD_LIBRARY_PATH_64)] {
90
      set orig_ld_library_path_64 "$env(LD_LIBRARY_PATH_64)"
91
      set orig_ld_library_path_64_saved 1
92
    }
93
    if [info exists env(DYLD_LIBRARY_PATH)] {
94
      set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)"
95
      set orig_dyld_library_path_saved 1
96
    }
97
  }
98
 
99
  # We need to set ld library path in the environment.  Currently,
100
  # unix.exp doesn't set the environment correctly for all systems.
101
  # It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a
102
  # program.  We also need the environment set for compilations, etc.
103
  #
104
  # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
105
  # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
106
  # (for the 64-bit ABI).  The same applies to Darwin (DYLD_LIBRARY_PATH),
107
  # Solaris 32 bit (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64),
108
  # and HP-UX (SHLIB_PATH).  In some cases, the variables are independent
109
  # of LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the
110
  # variable is not defined.
111
  #
112
  # Doing this is somewhat of a hack as ld_library_path gets repeated in
113
  # SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables.
114
  if { $orig_ld_library_path_saved } {
115
    setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path"
116
  } else {
117
    setenv LD_LIBRARY_PATH "$ld_library_path"
118
  }
119
  if { $orig_ld_run_path_saved } {
120
    setenv LD_RUN_PATH "$ld_library_path:$orig_ld_run_path"
121
  } else {
122
    setenv LD_RUN_PATH "$ld_library_path"
123
  }
124
  # The default shared library dynamic path search for 64-bit
125
  # HP-UX executables searches LD_LIBRARY_PATH before SHLIB_PATH.
126
  # LD_LIBRARY_PATH isn't used for 32-bit executables.  Thus, we
127
  # set LD_LIBRARY_PATH and SHLIB_PATH as if they were independent.
128
  if { $orig_shlib_path_saved } {
129
    setenv SHLIB_PATH "$ld_library_path:$orig_shlib_path"
130
  } else {
131
    setenv SHLIB_PATH "$ld_library_path"
132
  }
133
  if { $orig_ld_libraryn32_path_saved } {
134
    setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_libraryn32_path"
135
  } elseif { $orig_ld_library_path_saved } {
136
    setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_library_path"
137
  } else {
138
    setenv LD_LIBRARYN32_PATH "$ld_library_path"
139
  }
140
  if { $orig_ld_library64_path_saved } {
141
    setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library64_path"
142
  } elseif { $orig_ld_library_path_saved } {
143
    setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library_path"
144
  } else {
145
    setenv LD_LIBRARY64_PATH "$ld_library_path"
146
  }
147
  if { $orig_ld_library_path_32_saved } {
148
    setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path_32"
149
  } elseif { $orig_ld_library_path_saved } {
150
    setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path"
151
  } else {
152
    setenv LD_LIBRARY_PATH_32 "$ld_library_path"
153
  }
154
  if { $orig_ld_library_path_64_saved } {
155
    setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path_64"
156
  } elseif { $orig_ld_library_path_saved } {
157
    setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path"
158
  } else {
159
    setenv LD_LIBRARY_PATH_64 "$ld_library_path"
160
  }
161
  if { $orig_dyld_library_path_saved } {
162
    setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path"
163
  } else {
164
    setenv DYLD_LIBRARY_PATH "$ld_library_path"
165
  }
166
 
167
  verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path"
168
}
169
 
170
#######################################
171
# proc restore_ld_library_path_env_vars { }
172
#######################################
173
 
174
proc restore_ld_library_path_env_vars { } {
175
  global orig_environment_saved
176
  global orig_ld_library_path_saved
177
  global orig_ld_run_path_saved
178
  global orig_shlib_path_saved
179
  global orig_ld_libraryn32_path_saved
180
  global orig_ld_library64_path_saved
181
  global orig_ld_library_path_32_saved
182
  global orig_ld_library_path_64_saved
183
  global orig_dyld_library_path_saved
184
  global orig_ld_library_path
185
  global orig_ld_run_path
186
  global orig_shlib_path
187
  global orig_ld_libraryn32_path
188
  global orig_ld_library64_path
189
  global orig_ld_library_path_32
190
  global orig_ld_library_path_64
191
  global orig_dyld_library_path
192
 
193
  if { $orig_environment_saved == 0 } {
194
    return
195
  }
196
 
197
  if { $orig_ld_library_path_saved } {
198
    setenv LD_LIBRARY_PATH "$orig_ld_library_path"
199
  } elseif [info exists env(LD_LIBRARY_PATH)] {
200
    unsetenv LD_LIBRARY_PATH
201
  }
202
  if { $orig_ld_run_path_saved } {
203
    setenv LD_RUN_PATH "$orig_ld_run_path"
204
  } elseif [info exists env(LD_RUN_PATH)] {
205
    unsetenv LD_RUN_PATH
206
  }
207
  if { $orig_shlib_path_saved } {
208
    setenv SHLIB_PATH "$orig_shlib_path"
209
  } elseif [info exists env(SHLIB_PATH)] {
210
    unsetenv SHLIB_PATH
211
  }
212
  if { $orig_ld_libraryn32_path_saved } {
213
    setenv LD_LIBRARYN32_PATH "$orig_ld_libraryn32_path"
214
  } elseif [info exists env(LD_LIBRARYN32_PATH)] {
215
    unsetenv LD_LIBRARYN32_PATH
216
  }
217
  if { $orig_ld_library64_path_saved } {
218
    setenv LD_LIBRARY64_PATH "$orig_ld_library64_path"
219
  } elseif [info exists env(LD_LIBRARY64_PATH)] {
220
    unsetenv LD_LIBRARY64_PATH
221
  }
222
  if { $orig_ld_library_path_32_saved } {
223
    setenv LD_LIBRARY_PATH_32 "$orig_ld_library_path_32"
224
  } elseif [info exists env(LD_LIBRARY_PATH_32)] {
225
    unsetenv LD_LIBRARY_PATH_32
226
  }
227
  if { $orig_ld_library_path_64_saved } {
228
    setenv LD_LIBRARY_PATH_64 "$orig_ld_library_path_64"
229
  } elseif [info exists env(LD_LIBRARY_PATH_64)] {
230
    unsetenv LD_LIBRARY_PATH_64
231
  }
232
  if { $orig_dyld_library_path_saved } {
233
    setenv DYLD_LIBRARY_PATH "$orig_dyld_library_path"
234
  } elseif [info exists env(DYLD_LIBRARY_PATH)] {
235
    unsetenv DYLD_LIBRARY_PATH
236
  }
237
}
238
 
239
#######################################
240
# proc get_shlib_extension { }
241
#######################################
242
 
243
proc get_shlib_extension { } {
244
    global shlib_ext
245
 
246
    if { [ istarget *-*-darwin* ] } {
247
        set shlib_ext "dylib"
248
    } elseif { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } {
249
        set shlib_ext "dll"
250
    } elseif { [ istarget hppa*-*-hpux* ] } {
251
        set shlib_ext "sl"
252
    } else {
253
        set shlib_ext "so"
254
    }
255
    return $shlib_ext
256
}
257
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.