From e1ebadb85b250f950d0f5415eda83209f94378c1 Mon Sep 17 00:00:00 2001 From: Björn Jacke Date: Fri, 2 Oct 2009 19:53:53 +0200 Subject: s3:configure: use --aѕ-needed linker option when supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on a patch from Andreas Schneider but modified that --aѕ-needed is also used when own libs are not build shared (--enable-shared). Also change order of options so that user supplied LDFLAGS are put *after* the automatic --aѕ-needed flag. This way it's pollible to force not use as-needed by setting LDFLAGS environment variable to "-Wl,--no-as-needed". --- source3/configure.in | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source3/configure.in b/source3/configure.in index 93de38dcc8..7e4ae87757 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -1706,6 +1706,23 @@ fi AC_MSG_RESULT($BLDSHARED) +if test x"${ac_cv_prog_gnu_ld}" = x"yes"; then + saved_ldflags="$LDFLAGS" + AC_MSG_CHECKING([if --as-needed works]) + LDFLAGS="--as-needed $saved_ldflags" + AC_TRY_LINK([],[], + [AC_MSG_RESULT([yes]) + LD_AS_NEEDED_FLAG=--as-needed], + AC_MSG_RESULT([no])) + AC_MSG_CHECKING([if -Wl,--as-needed works]) + LDFLAGS="-Wl,--as-needed $saved_ldflags" + AC_TRY_LINK([],[], + [AC_MSG_RESULT([yes]) + LD_AS_NEEDED_FLAG=-Wl,--as-needed], + AC_MSG_RESULT([no])) + LDFLAGS="$LD_AS_NEEDED_FLAG $saved_ldflags" +fi + AC_MSG_CHECKING([LDFLAGS]) AC_MSG_RESULT([$LDFLAGS]) AC_MSG_CHECKING([DYNEXP]) -- cgit