diff options
author | Alan Modra <amodra@bigpond.net.au> | 2009-03-04 02:10:34 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2009-03-04 02:10:34 +0000 |
commit | 5b7211741d5559f0a130c54c0a5fd580537449c5 (patch) | |
tree | 55f3e78f76461d6a37fe919a1b8d1f065534c926 /opcodes/configure.in | |
parent | 98a41c54d410c42303144fff944bc735452e2f16 (diff) | |
download | binutils-redhat-5b7211741d5559f0a130c54c0a5fd580537449c5.tar.gz |
bfd/
PR 6768
* configure.in: Test for ld --as-needed support. Link shared
libbfd against libm.
* configure: Regenerate.
opcodes/
PR 6768
* configure.in: Test for ld --as-needed support. Link shared
libopcodes against libm.
* configure: Regenerate.
Diffstat (limited to 'opcodes/configure.in')
-rw-r--r-- | opcodes/configure.in | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/opcodes/configure.in b/opcodes/configure.in index 8bebe7e323..2ecff8cc5f 100644 --- a/opcodes/configure.in +++ b/opcodes/configure.in @@ -91,6 +91,16 @@ AC_SUBST(cgendir) using_cgen=no +# Check if linker supports --as-needed and --no-as-needed options +AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, + [bfd_cv_ld_as_needed=no + if $LD --help 2>/dev/null | grep as-needed > /dev/null; then + bfd_cv_ld_as_needed=yes + fi + ]) + +LT_LIB_M + # Horrible hacks to build DLLs on Windows and a shared library elsewhere. SHARED_LDFLAGS= SHARED_LIBADD= @@ -132,6 +142,18 @@ changequote([,])dnl SHARED_DEPENDENCIES="../bfd/libbfd.la" ;; esac + + if test -n "$SHARED_LIBADD"; then + if test -n "$LIBM"; then + if test x"$bfd_cv_ld_as_needed" = xyes; then + # Link against libm only when needed. Put -lc, -lm inside -Wl + # to stop libtool reordering these options. + SHARED_LIBADD="$SHARED_LIBADD -Wl,-lc,--as-needed,`echo $LIBM | sed 's/ /,/g'`,--no-as-needed" + else + SHARED_LIBADD="$SHARED_LIBADD $LIBM" + fi + fi + fi fi AC_SUBST(SHARED_LDFLAGS) AC_SUBST(SHARED_LIBADD) |