OSDN Git Service

[toplevel]
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / lib / obj-c++.exp
index c580518..b61dc55 100644 (file)
@@ -1,18 +1,18 @@
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
 
 # This file was written by Rob Savoye (rob@cygnus.com)
 # Many modifications by Jeffrey Wheat (cassidy@cygnus.com)
@@ -23,6 +23,7 @@
 #
 load_lib prune.exp
 load_lib gcc-defs.exp
+load_lib timeout.exp
 load_lib target-libpath.exp
 
 #
@@ -100,11 +101,14 @@ proc obj-c++_link_flags { paths } {
     global srcdir
     global ld_library_path
     global OBJCXX_UNDER_TEST
+    global shlib_ext
 
     set gccpath ${paths}
     set libio_dir ""
     set flags ""
     set ld_library_path "."
+    set shlib_ext [get_shlib_extension]
+    verbose "shared lib extension: $shlib_ext"
 
     if { $gccpath != "" } {
       if [file exists "${gccpath}/lib/libstdc++.a"] {
@@ -122,6 +126,11 @@ proc obj-c++_link_flags { paths } {
           append flags " -L${gccpath}/libstdc++-v3/src/.libs "
           append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
       }
+      # Look for libstdc++.${shlib_ext}.
+      if [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] {
+         append flags " -L${gccpath}/libstdc++-v3/src/.libs "
+         append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
+      }
       if [file exists "${gccpath}/libiberty/libiberty.a"] {
           append flags "-L${gccpath}/libiberty "
       }
@@ -134,27 +143,26 @@ proc obj-c++_link_flags { paths } {
       if { $libobjc_dir == ""} {
          set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a]
       }
+      # Now check if we have a shared only build.
+      if { $libobjc_dir == ""} {
+         set libobjc_dir \
+             [lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}]
+      }
+      if { $libobjc_dir == ""} {
+         set libobjc_dir \
+             [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}]
+      }
+
+      verbose "libobjc_dir: $libobjc_dir"
+
       if { $libobjc_dir != "" } {
          set libobjc_dir [file dirname ${libobjc_dir}]
          append flags "-L${libobjc_dir}"
          append ld_library_path ":${libobjc_dir}"
       }
-    
-      append ld_library_path ":${rootme}"
-      set compiler [lindex $OBJCXX_UNDER_TEST 0]
-      if { [is_remote host] == 0 && [which $compiler] != 0 } {
-       foreach i "[exec $compiler --print-multi-lib]" {
-         set mldir ""
-         regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
-         set mldir [string trimright $mldir "\;@"]
-         if { "$mldir" == "." } {
-           continue
-         }
-         if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] == 1 } {
-           append ld_library_path ":${rootme}/${mldir}"
-         }
-       }
-      }
+      append ld_library_path \
+         [gcc-set-multilib-library-path $OBJCXX_UNDER_TEST]
+
     } else {
       global tool_root_dir;
 
@@ -208,7 +216,7 @@ proc obj-c++_init { args } {
            if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } {
                set OBJCXX_UNDER_TEST [transform c++]
            } else {
-               set OBJCXX_UNDER_TEST [findfile $base_dir/../g++ "$base_dir/../g++ -B$base_dir/../" [findfile $base_dir/g++ "$base_dir/g++ -B$base_dir/" [transform c++]]]
+               set OBJCXX_UNDER_TEST [findfile $base_dir/../../g++ "$base_dir/../../g++ -B$base_dir/../../" [findfile $base_dir/g++ "$base_dir/g++ -B$base_dir/" [transform c++]]]
            }
        }
     }
@@ -232,7 +240,7 @@ proc obj-c++_init { args } {
        unset gluefile
     }
 
-    obj-c++_maybe_build_wrapper "${tmpdir}/obj-c++-testglue.o"
+    obj-c++_maybe_build_wrapper "${tmpdir}/obj-c++-testglue.o" "-fexceptions"
 
     set ALWAYS_OBJCXXFLAGS ""
 
@@ -254,7 +262,7 @@ proc obj-c++_init { args } {
     # error-message parsing machinery.
     lappend ALWAYS_OBJCXXFLAGS "additional_flags=-fmessage-length=0"
 
-    if { [string match "powerpc-*-darwin*" $target_triplet] } {
+    if { [string match "*-*-darwin*" $target_triplet] } {
        lappend ALWAYS_OBJCXXFLAGS "ldflags=-multiply_defined suppress"
        }
 
@@ -274,8 +282,11 @@ proc obj-c++_target_compile { source dest type options } {
     global gluefile wrap_flags
     global ALWAYS_OBJCXXFLAGS
     global OBJCXX_UNDER_TEST
+    global shlib_ext
 
     lappend options "libs=-lobjc"
+    set shlib_ext [get_shlib_extension]
+    verbose "shared lib extension: $shlib_ext"
 
     if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
        lappend options "libs=${gluefile}"
@@ -292,9 +303,21 @@ proc obj-c++_target_compile { source dest type options } {
     if { $libobjc_dir == ""} {
       verbose "see if we have -fgnu-runtime in options"
       if [regexp ".*-fgnu-runtime.*" "${options}" ] {
-        set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a]
+         set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a]
       }
     }
+    if { $libobjc_dir == ""} {
+       set libobjc_dir \
+           [lookfor_file ${objcpath} libobjc/.libs/libobjc.${shlib_ext}]
+    }
+    if { $libobjc_dir == ""} {
+       verbose "see if we have -fgnu-runtime in options"
+       if [regexp ".*-fgnu-runtime.*" "${options}"] {
+        set libobjc_dir \
+            [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}]
+       }
+    }
+
     if { $libobjc_dir != "" } {
        set objc_include_dir "${srcdir}/../../libobjc"
        lappend options "additional_flags=-I${objc_include_dir}"
@@ -302,6 +325,7 @@ proc obj-c++_target_compile { source dest type options } {
 
     lappend options "additional_flags=[libio_include_flags]"
     lappend options "compiler=$OBJCXX_UNDER_TEST";
+    lappend options "timeout=[timeout_value]"
 
     set options [concat $gpp_compile_options $options]