global env libgcj_jar
global tool_root_dir
global libjava_libgcc_s_path
+ global target_triplet
if { $libjava_initialized == 1 } { return; }
if [info exists env(SHLIB_PATH)] {
set original_ld_library_path $env(SHLIB_PATH)
} else {
- set original_ld_library_path ""
+ if [info exists env(DYLD_LIBRARY_PATH)] {
+ set original_ld_library_path $env(DYLD_LIBRARY_PATH)
+ } else {
+ set original_ld_library_path ""
+ }
}
}
# Finally, add the gcc build directory so that we can find the
# shared libgcc. This, like much of dejagnu, is hideous.
set libjava_libgcc_s_path {}
- set gccdir [lookfor_file $tool_root_dir gcc/libgcc_s.so]
+
+ if { [string match "powerpc-*-darwin*" $target_triplet] } {
+ set so_extension "dylib"
+ } else {
+ set so_extension "so"
+ }
+ set gccdir [lookfor_file $tool_root_dir gcc/libgcc_s.${so_extension}]
if {$gccdir != ""} {
set gccdir [file dirname $gccdir]
lappend libjava_libgcc_s_path $gccdir
if { "$mldir" == "." } {
continue
}
- if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] == 1 } {
+ if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.${so_extension}.*]] == 1 } {
lappend libjava_libgcc_s_path "${gccdir}/${mldir}"
}
}
# paths. However we can't simply use those libraries; we still need
# libtool for linking.
# Don't return the the lib${name}.la files here, since this causes the
-# libraries to be linked twice: once as lib${name}.so and another time
+# libraries to be linked twice: once as lib${name}.so/dylib and another time
# via gcj's implicit -l${name}. This is both unnecessary and causes the
# Solaris ld to warn: attempted multiple inclusion of file. This warning
# is not ignored by the dejagnu framework and cannot be disabled.
global original_ld_library_path
setenv LD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
setenv SHLIB_PATH "$ld_library_path:$original_ld_library_path"
+ setenv DYLD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
verbose "LD_LIBRARY_PATH = $env(LD_LIBRARY_PATH)"
# Avoid libtool wrapper scripts when possible.
# but not if libtool warnings results in FAILs
if {$mode == "link"} {
- if {! [istarget "*-*-cygwin*"] && ! [istarget "*-*-mingw*"] } {
- lappend args "additional_flags=-no-install"
- }
+ if {! [istarget "*-*-cygwin*"] && ! [istarget "*-*-mingw*"] } {
+ lappend args "additional_flags=-no-install"
+ }
+ if { [istarget "*-*-darwin*"] } {
+ lappend args "additional_flags=-bind_at_load"
+ lappend args "additional_flags=-multiply_defined suppress"
+ }
}
return $args
setenv LD_LIBRARY_PATH $newval
setenv SHLIB_PATH $newval
+ setenv DYLD_LIBRARY_PATH $newval
verbose "LD_LIBRARY_PATH=$env(LD_LIBRARY_PATH)"
# Restore setting
setenv LD_LIBRARY_PATH $lib_path
setenv SHLIB_PATH $lib_path
+ setenv DYLD_LIBRAY_PATH $lib_path
if {$status != "pass"} {
verbose "got $output"