Commit 2e58f311 by Andreas Tobler Committed by Andreas Tobler

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
parent ef9db8d5
2005-11-11 Andreas Tobler <a.tobler@schweiz.ch> 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. * gfortran.dg/static_linking_1.f: Fix static_libgfortran processing.
* lib/target-supports.exp (check_effective_target_static_libgfortran): * lib/target-supports.exp (check_effective_target_static_libgfortran):
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003,
# Free Software Foundation, Inc. # 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # 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 # 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 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
...@@ -100,12 +100,16 @@ proc g++_link_flags { paths } { ...@@ -100,12 +100,16 @@ proc g++_link_flags { paths } {
global srcdir global srcdir
global ld_library_path global ld_library_path
global GXX_UNDER_TEST global GXX_UNDER_TEST
global shlib_ext
set gccpath ${paths} set gccpath ${paths}
set libio_dir "" set libio_dir ""
set flags "" set flags ""
set ld_library_path "." set ld_library_path "."
set shlib_ext [get_shlib_extension]
verbose "shared lib extension: $shlib_ext"
if { $gccpath != "" } { if { $gccpath != "" } {
if [file exists "${gccpath}/lib/libstdc++.a"] { if [file exists "${gccpath}/lib/libstdc++.a"] {
append ld_library_path ":${gccpath}/lib" append ld_library_path ":${gccpath}/lib"
...@@ -122,6 +126,12 @@ proc g++_link_flags { paths } { ...@@ -122,6 +126,12 @@ proc g++_link_flags { paths } {
append flags " -L${gccpath}/libstdc++-v3/src/.libs " append flags " -L${gccpath}/libstdc++-v3/src/.libs "
append ld_library_path ":${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"] { if [file exists "${gccpath}/libiberty/libiberty.a"] {
append flags "-L${gccpath}/libiberty " append flags "-L${gccpath}/libiberty "
} }
......
# 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 # 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 # 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 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
...@@ -76,17 +76,24 @@ proc gfortran_link_flags { paths } { ...@@ -76,17 +76,24 @@ proc gfortran_link_flags { paths } {
global srcdir global srcdir
global ld_library_path global ld_library_path
global GFORTRAN_UNDER_TEST global GFORTRAN_UNDER_TEST
global shlib_ext
set gccpath ${paths} set gccpath ${paths}
set libio_dir "" set libio_dir ""
set flags "" set flags ""
set ld_library_path "." set ld_library_path "."
set shlib_ext [get_shlib_extension]
verbose "shared lib extension: $shlib_ext"
if { $gccpath != "" } { if { $gccpath != "" } {
if [file exists "${gccpath}/libgfortran/.libs/libgfortran.a"] { if [file exists "${gccpath}/libgfortran/.libs/libgfortran.a"] {
append flags "-L${gccpath}/libgfortran/.libs " append flags "-L${gccpath}/libgfortran/.libs "
append ld_library_path ":${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"] { if [file exists "${gccpath}/libgfortran/libgforbegin.a"] {
append flags "-L${gccpath}/libgfortran " append flags "-L${gccpath}/libgfortran "
} }
......
# 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 # 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 # 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 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
...@@ -100,11 +100,14 @@ proc obj-c++_link_flags { paths } { ...@@ -100,11 +100,14 @@ proc obj-c++_link_flags { paths } {
global srcdir global srcdir
global ld_library_path global ld_library_path
global OBJCXX_UNDER_TEST global OBJCXX_UNDER_TEST
global shlib_ext
set gccpath ${paths} set gccpath ${paths}
set libio_dir "" set libio_dir ""
set flags "" set flags ""
set ld_library_path "." set ld_library_path "."
set shlib_ext [get_shlib_extension]
verbose "shared lib extension: $shlib_ext"
if { $gccpath != "" } { if { $gccpath != "" } {
if [file exists "${gccpath}/lib/libstdc++.a"] { if [file exists "${gccpath}/lib/libstdc++.a"] {
...@@ -122,6 +125,11 @@ proc obj-c++_link_flags { paths } { ...@@ -122,6 +125,11 @@ proc obj-c++_link_flags { paths } {
append flags " -L${gccpath}/libstdc++-v3/src/.libs " append flags " -L${gccpath}/libstdc++-v3/src/.libs "
append ld_library_path ":${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"] { if [file exists "${gccpath}/libiberty/libiberty.a"] {
append flags "-L${gccpath}/libiberty " append flags "-L${gccpath}/libiberty "
} }
...@@ -134,27 +142,26 @@ proc obj-c++_link_flags { paths } { ...@@ -134,27 +142,26 @@ proc obj-c++_link_flags { paths } {
if { $libobjc_dir == ""} { if { $libobjc_dir == ""} {
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 == ""} {
set libobjc_dir \
[lookfor_file ${objcpath} libobjc/.libs/libobjc-gnu.${shlib_ext}]
}
verbose "libobjc_dir: $libobjc_dir"
if { $libobjc_dir != "" } { if { $libobjc_dir != "" } {
set libobjc_dir [file dirname ${libobjc_dir}] set libobjc_dir [file dirname ${libobjc_dir}]
append flags "-L${libobjc_dir}" append flags "-L${libobjc_dir}"
append ld_library_path ":${libobjc_dir}" append ld_library_path ":${libobjc_dir}"
} }
append ld_library_path \
append ld_library_path ":${rootme}" [gcc-set-multilib-library-path $OBJCXX_UNDER_TEST]
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}"
}
}
}
} else { } else {
global tool_root_dir; global tool_root_dir;
...@@ -274,8 +281,11 @@ proc obj-c++_target_compile { source dest type options } { ...@@ -274,8 +281,11 @@ proc obj-c++_target_compile { source dest type options } {
global gluefile wrap_flags global gluefile wrap_flags
global ALWAYS_OBJCXXFLAGS global ALWAYS_OBJCXXFLAGS
global OBJCXX_UNDER_TEST global OBJCXX_UNDER_TEST
global shlib_ext
lappend options "libs=-lobjc" 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] } { if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
lappend options "libs=${gluefile}" lappend options "libs=${gluefile}"
...@@ -292,9 +302,21 @@ proc obj-c++_target_compile { source dest type options } { ...@@ -292,9 +302,21 @@ proc obj-c++_target_compile { source dest type options } {
if { $libobjc_dir == ""} { if { $libobjc_dir == ""} {
verbose "see if we have -fgnu-runtime in options" verbose "see if we have -fgnu-runtime in options"
if [regexp ".*-fgnu-runtime.*" "${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 != "" } { if { $libobjc_dir != "" } {
set objc_include_dir "${srcdir}/../../libobjc" set objc_include_dir "${srcdir}/../../libobjc"
lappend options "additional_flags=-I${objc_include_dir}" lappend options "additional_flags=-I${objc_include_dir}"
......
# 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. # Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # 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 # 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 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
...@@ -127,9 +127,12 @@ proc objc_target_compile { source dest type options } { ...@@ -127,9 +127,12 @@ proc objc_target_compile { source dest type options } {
global TOOL_OPTIONS global TOOL_OPTIONS
global ld_library_path global ld_library_path
global objc_libgcc_s_path global objc_libgcc_s_path
global shlib_ext
set ld_library_path ".:${objc_libgcc_s_path}" set ld_library_path ".:${objc_libgcc_s_path}"
lappend options "libs=-lobjc" 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] } { if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
lappend options "libs=${gluefile}" lappend options "libs=${gluefile}"
...@@ -161,9 +164,21 @@ proc objc_target_compile { source dest type options } { ...@@ -161,9 +164,21 @@ proc objc_target_compile { source dest type options } {
if { $libobjc_dir == ""} { if { $libobjc_dir == ""} {
verbose "see if we have -fgnu-runtime in options" verbose "see if we have -fgnu-runtime in options"
if [regexp ".*-fgnu-runtime.*" "${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 != "" } { if { $libobjc_dir != "" } {
set objc_include_dir "${srcdir}/../../libobjc" set objc_include_dir "${srcdir}/../../libobjc"
lappend options "additional_flags=-I${objc_include_dir}" lappend options "additional_flags=-I${objc_include_dir}"
......
# 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 # 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 # 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 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
...@@ -235,3 +235,23 @@ proc restore_ld_library_path_env_vars { } { ...@@ -235,3 +235,23 @@ proc restore_ld_library_path_env_vars { } {
unsetenv DYLD_LIBRARY_PATH 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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment