OSDN Git Service

PR testsuite/28870
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / lib / objc.exp
index 9dbbc3c..1705979 100644 (file)
@@ -1,19 +1,19 @@
-# Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2004
-# Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2004, 2005,
+# 2007 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)
 # Currently maintained by Doug Evans (dje@cygnus.com)
@@ -28,6 +28,7 @@
 load_lib libgloss.exp
 load_lib prune.exp
 load_lib gcc-defs.exp
+load_lib timeout.exp
 load_lib target-libpath.exp
 
 #
@@ -115,7 +116,7 @@ proc objc_init { args } {
 
     objc_maybe_build_wrapper "${tmpdir}/objc-testglue.o"
 
-    append objc_libgcc_s_path [gcc-set-multilib-library-path $OBJC_UNDER_TEST]
+    set objc_libgcc_s_path [gcc-set-multilib-library-path $OBJC_UNDER_TEST]
 }
 
 proc objc_target_compile { source dest type options } {
@@ -127,9 +128,12 @@ proc objc_target_compile { source dest type options } {
     global TOOL_OPTIONS
     global ld_library_path
     global objc_libgcc_s_path
+    global shlib_ext
 
     set ld_library_path ".:${objc_libgcc_s_path}"
     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}"
@@ -159,11 +163,23 @@ proc objc_target_compile { source dest type options } {
 
     set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc.a]
     if { $libobjc_dir == ""} {
-      verbose "see if we have -fgnu-runtime in [target_info name]"
-      if [regexp ".*-fgnu-runtime.*" [target_info name]] {
-        set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.a]
+      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]
       }
     }
+    # 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 == ""} {
+       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}"
@@ -172,7 +188,13 @@ proc objc_target_compile { source dest type options } {
        lappend options "additional_flags=${objc_link_flags}"
        append ld_library_path ":${libobjc_dir}"
     }
+    if { $type == "precompiled_header" } {
+       # If we generating a precompiled header, we have say this is an
+       # objective-C header
+       set source [concat "-x objective-c-header" $source]
+    }
     lappend options "compiler=$OBJC_UNDER_TEST"
+    lappend options "timeout=[timeout_value]"
 
     set_ld_library_path_env_vars