aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Tobler <a.tobler@schweiz.ch>2005-11-11 23:31:35 +0100
committerAndreas Tobler <andreast@gcc.gnu.org>2005-11-11 23:31:35 +0100
commit2e58f3119124537a14178f17ed47e7bbb99619aa (patch)
tree9912b445975387b48d7dcfe5b9db490ec311b6e7
parentef9db8d5dd2a8a1685693090b2225ab1db8c0a73 (diff)
downloadgcc-2e58f3119124537a14178f17ed47e7bbb99619aa.zip
gcc-2e58f3119124537a14178f17ed47e7bbb99619aa.tar.gz
gcc-2e58f3119124537a14178f17ed47e7bbb99619aa.tar.bz2
target-libpath.exp (get_shlib_extension): New proc.
2005-11-11 Andreas Tobler <a.tobler@schweiz.ch> * lib/target-libpath.exp (get_shlib_extension): New proc. * lib/g++.exp (g++_link_flags): Add flags in case of shared only build. * lib/gfortran.exp (gfortran_link_flags): Likewise. * lib/objc.exp (objc_target_compile): Likewise. * lib/obj-c++.exp (obj-c++_link_flags): Likewise. Fix multilib libgcc detection. From-SVN: r106802
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/lib/g++.exp18
-rw-r--r--gcc/testsuite/lib/gfortran.exp13
-rw-r--r--gcc/testsuite/lib/obj-c++.exp62
-rw-r--r--gcc/testsuite/lib/objc.exp23
-rw-r--r--gcc/testsuite/lib/target-libpath.exp26
6 files changed, 117 insertions, 34 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 03be1ca..59e5d45 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,14 @@
2005-11-11 Andreas Tobler <a.tobler@schweiz.ch>
+ * lib/target-libpath.exp (get_shlib_extension): New proc.
+ * lib/g++.exp (g++_link_flags): Add flags in case of shared only build.
+ * lib/gfortran.exp (gfortran_link_flags): Likewise.
+ * lib/objc.exp (objc_target_compile): Likewise.
+ * lib/obj-c++.exp (obj-c++_link_flags): Likewise. Fix multilib libgcc
+ detection.
+
+2005-11-11 Andreas Tobler <a.tobler@schweiz.ch>
+
* gfortran.dg/static_linking_1.f: Fix static_libgfortran processing.
* lib/target-supports.exp (check_effective_target_static_libgfortran):
diff --git a/gcc/testsuite/lib/g++.exp b/gcc/testsuite/lib/g++.exp
index cd47dee..c907e54 100644
--- a/gcc/testsuite/lib/g++.exp
+++ b/gcc/testsuite/lib/g++.exp
@@ -1,16 +1,16 @@
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004
-# Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003,
+# 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -100,12 +100,16 @@ proc g++_link_flags { paths } {
global srcdir
global ld_library_path
global GXX_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"] {
append ld_library_path ":${gccpath}/lib"
@@ -122,6 +126,12 @@ proc g++_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 "
}
diff --git a/gcc/testsuite/lib/gfortran.exp b/gcc/testsuite/lib/gfortran.exp
index ee64d9b..435d715 100644
--- a/gcc/testsuite/lib/gfortran.exp
+++ b/gcc/testsuite/lib/gfortran.exp
@@ -1,15 +1,15 @@
-# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -76,17 +76,24 @@ proc gfortran_link_flags { paths } {
global srcdir
global ld_library_path
global GFORTRAN_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}/libgfortran/.libs/libgfortran.a"] {
append flags "-L${gccpath}/libgfortran/.libs "
append ld_library_path ":${gccpath}/libgfortran/.libs"
}
+ if [file exists "${gccpath}/libgfortran/.libs/libgfortran.${shlib_ext}"] {
+ append flags "-L${gccpath}/libgfortran/.libs "
+ append ld_library_path ":${gccpath}/libgfortran/.libs"
+ }
if [file exists "${gccpath}/libgfortran/libgforbegin.a"] {
append flags "-L${gccpath}/libgfortran "
}
diff --git a/gcc/testsuite/lib/obj-c++.exp b/gcc/testsuite/lib/obj-c++.exp
index c580518..ccb82d0 100644
--- a/gcc/testsuite/lib/obj-c++.exp
+++ b/gcc/testsuite/lib/obj-c++.exp
@@ -1,15 +1,15 @@
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -100,11 +100,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 +125,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 +142,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;
@@ -274,8 +281,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 +302,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}"
diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp
index 87ccdac..18cdfea 100644
--- a/gcc/testsuite/lib/objc.exp
+++ b/gcc/testsuite/lib/objc.exp
@@ -1,16 +1,16 @@
-# Copyright (C) 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2004
+# 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -127,9 +127,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}"
@@ -161,9 +164,21 @@ proc objc_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]
}
}
+ # 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}"
diff --git a/gcc/testsuite/lib/target-libpath.exp b/gcc/testsuite/lib/target-libpath.exp
index 85f201b..8aca0ed 100644
--- a/gcc/testsuite/lib/target-libpath.exp
+++ b/gcc/testsuite/lib/target-libpath.exp
@@ -1,15 +1,15 @@
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -235,3 +235,23 @@ proc restore_ld_library_path_env_vars { } {
unsetenv DYLD_LIBRARY_PATH
}
}
+
+#######################################
+# proc get_shlib_extension { }
+#######################################
+
+proc get_shlib_extension { } {
+ global shlib_ext
+
+ if { [ istarget *-*-darwin* ] } {
+ set shlib_ext "dylib"
+ } elseif { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } {
+ set shlib_ext "dll"
+ } elseif { [ istarget hppa*-*-hpux* ] } {
+ set shlib_ext "sl"
+ } else {
+ set shlib_ext "so"
+ }
+ return $shlib_ext
+}
+