Add cache variables to link tests.

* libltdl/m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER)
(_LT_LINKER_SHLIBS): Add cache variables to tests that
require the linker to work.  For shlibpath_overrides_runpath,
this also changes the semantics to let the result from the C
compiler take precedence.
* tests/no-executables.at (AC_NO_EXECUTABLES): New file.
* Makefile.am: Update.
* NEWS: Update.
Report of shlibpath_overrides_runpath issue by Mike Frysinger,
report of GCC issue by Andreas Schwab.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
This commit is contained in:
Ralf Wildenhues 2008-12-17 20:41:57 +01:00
parent 430f9c6e6c
commit b7dbec6b9d
5 changed files with 140 additions and 38 deletions

View File

@ -1,3 +1,17 @@
2008-12-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Add cache variables to link tests.
* libltdl/m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER)
(_LT_LINKER_SHLIBS): Add cache variables to tests that
require the linker to work. For shlibpath_overrides_runpath,
this also changes the semantics to let the result from the C
compiler take precedence.
* tests/no-executables.at (AC_NO_EXECUTABLES): New file.
* Makefile.am: Update.
* NEWS: Update.
Report of shlibpath_overrides_runpath issue by Mike Frysinger,
report of GCC issue by Andreas Schwab.
2008-11-28 Paolo Bonzini <bonzini@gnu.org>
Fix inadvertent commit.

View File

@ -483,6 +483,7 @@ TESTSUITE_AT = tests/testsuite.at \
tests/template.at \
tests/ctor.at \
tests/early-libtool.at \
tests/no-executables.at \
tests/deplibs-ident.at \
tests/configure-iface.at \
tests/stresstest.at \

2
NEWS
View File

@ -24,6 +24,8 @@ New in 2.2.8 2008-??-??: git version 2.2.7a, Libtool team:
- libtool command line flag --verbose now also enables explicit
verbose output, in addition to its previous behavior of (re)enabling
only the default informational output. See New Features, --no-silent.
- Link tests are guarded by cache variables so they can be avoided for
bootstrapping purposes (e.g., when link tests are not possible).
* Miscellaneous changes:

83
libltdl/m4/libtool.m4 vendored
View File

@ -2389,16 +2389,21 @@ linux* | k*bsd*-gnu)
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
# Some binutils ld are patched to set DT_RUNPATH
save_LDFLAGS=$LDFLAGS
save_libdir=$libdir
eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
[shlibpath_overrides_runpath=yes])])
LDFLAGS=$save_LDFLAGS
libdir=$save_libdir
AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
[lt_cv_shlibpath_overrides_runpath=no
save_LDFLAGS=$LDFLAGS
save_libdir=$libdir
eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
[AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
[lt_cv_shlibpath_overrides_runpath=yes])])
LDFLAGS=$save_LDFLAGS
libdir=$save_libdir
])
shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
# This implies no fast_install, which is unacceptable.
# Some rework will be needed to allow for fast_install
@ -5055,36 +5060,38 @@ x|xyes)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
AC_MSG_CHECKING([whether -lc should be explicitly linked in])
$RM conftest*
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
AC_CACHE_CHECK([whether -lc should be explicitly linked in],
[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
[$RM conftest*
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
soname=conftest
lib=conftest
libobjs=conftest.$ac_objext
deplibs=
wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
compiler_flags=-v
linker_flags=-v
verstring=
output_objdir=.
libname=conftest
lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
_LT_TAGVAR(allow_undefined_flag, $1)=
if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
then
_LT_TAGVAR(archive_cmds_need_lc, $1)=no
else
_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
fi
_LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
else
cat conftest.err 1>&5
fi
$RM conftest*
AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
soname=conftest
lib=conftest
libobjs=conftest.$ac_objext
deplibs=
wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
compiler_flags=-v
linker_flags=-v
verstring=
output_objdir=.
libname=conftest
lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
_LT_TAGVAR(allow_undefined_flag, $1)=
if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
then
lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
else
lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
fi
_LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
else
cat conftest.err 1>&5
fi
$RM conftest*
])
_LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
;;
esac
fi

78
tests/no-executables.at Normal file
View File

@ -0,0 +1,78 @@
# no-executables.at -- Libtool usage in GCC -*- Autotest -*-
# Copyright (C) 2008 Free Software Foundation, Inc.
# Written by Ralf Wildenhues, 2008
#
# This file is part of GNU Libtool.
#
# GNU Libtool 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.
#
# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
####
AT_BANNER([Libtool usage in GCC])
AT_SETUP([AC_NO_EXECUTABLES])
mkdir m4
AT_DATA([configure.ac],
[[AC_INIT([no-exec], [1])
AC_CONFIG_MACRO_DIR([m4])
# We punt a bit here, to get the results of AC_PROG_CC
# (and allow it to do link tests) but still error out on
# link tests within Libtool macros.
LDFLAGS=-lnosuchlibrary
AC_NO_EXECUTABLES
AC_PROG_CC
AC_PROG_CXX
AC_PROG_F77
AC_PROG_FC
AM_PROG_GCJ
# Consequently, we have to set cache variables for each link
# test we may need. For the purposes of this test, it shouldn't
# matter much whether these values are actually wrong, the point
# is that the linker should never be invoked.
lt_cv_shlibpath_overrides_runpath=no
lt_cv_archive_cmds_need_lc=no
lt_cv_cc_needs_belf=no
lt_cv_ld_exported_symbols_list=no
lt_cv_prog_compiler_static_works=no
# Deal with AC_LIBTOOL_DLOPEN in one of two possible ways:
# - do not execute it at all in the ac_no_link case
# - preset the individual Autoconf test variables
if ${test_ac_libtool_dlopen-false}; then
ac_cv_func_shl_load=no
ac_cv_lib_dld_shl_load=no
ac_cv_func_dlopen=no
ac_cv_lib_dl_dlopen=no
ac_cv_lib_svld_dlopen=no
ac_cv_lib_dld_dld_link=no
AC_LIBTOOL_DLOPEN
fi
AC_PROG_LIBTOOL
AC_OUTPUT
]])
LT_AT_BOOTSTRAP([--install], [-I m4], [ignore], [ignore], [], [ignore], [ignore])
LT_AT_CONFIGURE([])
LT_AT_CONFIGURE([test_ac_libtool_dlopen=:])
AT_CLEANUP