diff options
author | Björn Jacke <bj@sernet.de> | 2009-10-02 19:53:53 +0200 |
---|---|---|
committer | Björn Jacke <bj@sernet.de> | 2009-10-03 00:22:51 +0200 |
commit | e1ebadb85b250f950d0f5415eda83209f94378c1 (patch) | |
tree | 688e5dcfc590c7dc7c84ff529e83ebc55a6a734b /source3 | |
parent | 2aacca010da59c2521bddda3e004271008fe2b6f (diff) | |
download | samba-e1ebadb85b250f950d0f5415eda83209f94378c1.tar.gz samba-e1ebadb85b250f950d0f5415eda83209f94378c1.tar.bz2 samba-e1ebadb85b250f950d0f5415eda83209f94378c1.zip |
s3:configure: use --aѕ-needed linker option when supported
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".
Diffstat (limited to 'source3')
-rw-r--r-- | source3/configure.in | 17 |
1 files changed, 17 insertions, 0 deletions
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]) |