From 00dcdd97a81f2721c8ac19381de01aecd2aa2a88 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Jacke?= Date: Fri, 2 Oct 2009 19:53:53 +0200 Subject: [PATCH] =?utf8?q?s3:configure:=20use=20--a=D1=95-needed=20linker?= =?utf8?q?=20option=20when=20supported?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 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". (cherry picked from commit aaced534fb00445e4efa70392b6c0b22ab59b3cc) --- source3/configure.in | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source3/configure.in b/source3/configure.in index 93de38dcc84..7e4ae87757f 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]) -- 2.11.4.GIT