2003-11-19 Andreas Tobler <a.tobler@schweiz.ch>
authorandreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Nov 2003 04:53:29 +0000 (04:53 +0000)
committerandreast <andreast@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Nov 2003 04:53:29 +0000 (04:53 +0000)
* lib/libjava.exp: Add DYLD_LIBRARY_PATH for darwin. Look for
the right libgcc. Add -multiply_defined suppress and -bind_at_load
flags.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73725 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/testsuite/lib/libjava.exp

index bcd687e..6e27948 100644 (file)
@@ -1,3 +1,9 @@
+2003-11-19  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * lib/libjava.exp: Add DYLD_LIBRARY_PATH for darwin. Look for
+       the right libgcc. Add -multiply_defined suppress and -bind_at_load
+       flags.
+
 2003-11-18  Tom Tromey  <tromey@redhat.com>
 
        PR libgcj/13026:
index 42732f5..9ae1882 100644 (file)
@@ -137,6 +137,7 @@ proc libjava_init { args } {
     global env libgcj_jar
     global tool_root_dir
     global libjava_libgcc_s_path
+    global target_triplet
 
     if { $libjava_initialized == 1 } { return; }
 
@@ -177,7 +178,11 @@ proc libjava_init { args } {
        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 ""
+           }
        }
     }
 
@@ -196,7 +201,13 @@ proc libjava_init { args } {
     # 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
@@ -210,7 +221,7 @@ proc libjava_init { args } {
                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}"
                }
            }
@@ -228,7 +239,7 @@ proc libjava_init { args } {
 # 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.
@@ -352,6 +363,7 @@ proc libjava_arguments {{mode compile}} {
     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)"
 
@@ -401,9 +413,13 @@ proc libjava_arguments {{mode compile}} {
     # 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
@@ -444,6 +460,7 @@ proc gcj_invoke {program expectFile ld_library_additions} {
 
   setenv LD_LIBRARY_PATH $newval
   setenv SHLIB_PATH $newval
+  setenv DYLD_LIBRARY_PATH $newval
 
   verbose "LD_LIBRARY_PATH=$env(LD_LIBRARY_PATH)"
 
@@ -454,6 +471,7 @@ proc gcj_invoke {program expectFile ld_library_additions} {
   # 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"