X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Ftestsuite%2Flib%2Fobjc.exp;h=18cdfeaa880a3ee7046b37e3139eb1276bb5c9c8;hp=c315b6503b629d35d9cedce19f785d3738a4ed0a;hb=903355fcf4d044100232c4d4e92882fb9af23978;hpb=23ab4af6d8fc2f7a9791f36c3372c8abeb6a9869 diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp index c315b6503b6..18cdfeaa880 100644 --- a/gcc/testsuite/lib/objc.exp +++ b/gcc/testsuite/lib/objc.exp @@ -1,19 +1,19 @@ -# Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000, 2001 +# Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2004, 2005 # 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 # (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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # This file was written by Rob Savoye (rob@cygnus.com) # Currently maintained by Doug Evans (dje@cygnus.com) @@ -25,6 +25,11 @@ # They are also used by the various testsuites to define the environment: # where to find stdio.h, libc.a, etc. +load_lib libgloss.exp +load_lib prune.exp +load_lib gcc-defs.exp +load_lib target-libpath.exp + # # OBJC_UNDER_TEST is the compiler under test. # @@ -36,23 +41,23 @@ proc default_objc_version { } { global OBJC_UNDER_TEST - objc_init; + objc_init # ignore any arguments after the command set compiler [lindex $OBJC_UNDER_TEST 0] if ![is_remote host] { - set compiler_name [which $compiler]; + set compiler_name [which $compiler] } else { - set compiler_name $compiler; + set compiler_name $compiler } # verify that the compiler exists if { $compiler_name != 0 } then { set tmp [remote_exec host "$compiler -v"] - set status [lindex $tmp 0]; - set output [lindex $tmp 1]; - regexp "version.*$" $output version + set status [lindex $tmp 0] + set output [lindex $tmp 1] + regexp " version \[^\n\r\]*" $output version if { $status == 0 && [info exists version] } then { clone_output "$compiler_name $version\n" } else { @@ -68,7 +73,7 @@ proc default_objc_version { } { # Call objc_version. We do it this way so we can override it if needed. # proc objc_version { } { - default_objc_version; + default_objc_version } # @@ -81,18 +86,24 @@ proc objc_version { } { set objc_initialized 0 proc objc_init { args } { + global rootme global tmpdir global libdir global gluefile wrap_flags global objc_initialized global OBJC_UNDER_TEST global TOOL_EXECUTABLE + global objc_libgcc_s_path + + # We set LC_ALL and LANG to C so that we get the same error messages as expected. + setenv LC_ALL C + setenv LANG C if { $objc_initialized == 1 } { return; } if ![info exists OBJC_UNDER_TEST] then { if [info exists TOOL_EXECUTABLE] { - set OBJC_UNDER_TEST $TOOL_EXECUTABLE; + set OBJC_UNDER_TEST $TOOL_EXECUTABLE } else { set OBJC_UNDER_TEST [find_gcc] } @@ -101,28 +112,27 @@ proc objc_init { args } { if ![info exists tmpdir] then { set tmpdir /tmp } - if { [target_info needs_status_wrapper]!="" && ![info exists gluefile] } { - set gluefile ${tmpdir}/testglue.o; - set result [build_wrapper $gluefile]; - if { $result != "" } { - set gluefile [lindex $result 0]; - set wrap_flags [lindex $result 1]; - } else { - unset gluefile - } - } + + objc_maybe_build_wrapper "${tmpdir}/objc-testglue.o" + + append objc_libgcc_s_path [gcc-set-multilib-library-path $OBJC_UNDER_TEST] } proc objc_target_compile { source dest type options } { - global rootme; - global tmpdir; - global gluefile wrap_flags; + global rootme + global tmpdir + global gluefile wrap_flags + global srcdir global OBJC_UNDER_TEST global TOOL_OPTIONS global ld_library_path + global objc_libgcc_s_path + global shlib_ext - set ld_library_path ".:${rootme}" + 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}" @@ -138,21 +148,49 @@ proc objc_target_compile { source dest type options } { if [target_info exists objc,no_label_values] { lappend options "additional_flags=-DNO_LABEL_VALUES" } + # TOOL_OPTIONS must come first, so that it doesn't override testcase + # specific options. if [info exists TOOL_OPTIONS] { - lappend options "additional_flags=$TOOL_OPTIONS" - } - if [target_info exists objc,no_varargs] { - lappend options "additional_flags=-DNO_VARARGS" + set options [concat "{additional_flags=$TOOL_OPTIONS}" $options] } + + # If we have built libobjc along with the compiler (which usually + # _is not_ the case on Mac OS X systems), point the test harness + # at it (and associated headers). + set objcpath "[get_multilibs]" + set libobjc_dir [lookfor_file ${objcpath} libobjc/.libs/libobjc.a] + 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] + } + } + # 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}" set libobjc_dir [file dirname ${libobjc_dir}] set objc_link_flags "-L${libobjc_dir}" lappend options "additional_flags=${objc_link_flags}" append ld_library_path ":${libobjc_dir}" } lappend options "compiler=$OBJC_UNDER_TEST" + + set_ld_library_path_env_vars + return [target_compile $source $dest $type $options] } @@ -190,7 +228,7 @@ proc objc_fail { testcase cflags } { proc objc_finish { } { # The testing harness apparently requires this. - global errorInfo; + global errorInfo if [info exists errorInfo] then { unset errorInfo @@ -204,11 +242,11 @@ proc objc_finish { } { } proc objc_exit { } { - global gluefile; + global gluefile if [info exists gluefile] { - file_on_build delete $gluefile; - unset gluefile; + file_on_build delete $gluefile + unset gluefile } }