aboutsummaryrefslogtreecommitdiff
path: root/bfd/configure.in
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2009-03-04 02:10:34 +0000
committerAlan Modra <amodra@gmail.com>2009-03-04 02:10:34 +0000
commit51dec22749b3733b1fa3df0c1290a50967887ccf (patch)
treefacb4cb39146093e91e42897ba36a8a4e40b55d6 /bfd/configure.in
parenta1f7ca36bff182786ef15618af3f749719fc518f (diff)
downloadgdb-51dec22749b3733b1fa3df0c1290a50967887ccf.zip
gdb-51dec22749b3733b1fa3df0c1290a50967887ccf.tar.gz
gdb-51dec22749b3733b1fa3df0c1290a50967887ccf.tar.bz2
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 'bfd/configure.in')
-rw-r--r--bfd/configure.in22
1 files changed, 22 insertions, 0 deletions
diff --git a/bfd/configure.in b/bfd/configure.in
index a56004d..fe780a9 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -494,6 +494,16 @@ if test -n "$TRAD_HEADER"; then
[Name of host specific header file to include in trad-core.c.])
fi
+# 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
+
# When building a shared libbfd, link against the pic version of libiberty
# so that apps that use libbfd won't need libiberty just to satisfy any
# libbfd references.
@@ -516,6 +526,18 @@ changequote([,])dnl
SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
;;
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)