X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Flib-ignore.m4;h=e518f811334d754edfcde723d1573ff1438d4548;hb=4097b52187106b6a2940d28968cfecd4e53f9b4e;hp=348f6f44ae073ea031268caf0f0e81f6baa9ffd3;hpb=79d781960a92f388a71e6e2e7b5b80538bf130d1;p=gnulib.git diff --git a/m4/lib-ignore.m4 b/m4/lib-ignore.m4 index 348f6f44a..e518f8113 100644 --- a/m4/lib-ignore.m4 +++ b/m4/lib-ignore.m4 @@ -13,15 +13,30 @@ AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES], [gl_cv_ignore_unused_libraries], [gl_cv_ignore_unused_libraries=none gl_saved_ldflags=$LDFLAGS + gl_saved_libs=$LIBS + # Link with -lm to detect binutils 2.16 bug with --as-needed; see + # . + LIBS="$LIBS -lm" # Use long option sequences like '-z ignore' to test for the feature, # to forestall problems with linkers that have -z, -i, -g, -n, etc. flags. - for gl_flags in '-Wl,-z,ignore' '-z ignore'; do + # GCC + binutils likes '-Wl,--as-needed'. + # GCC + Solaris ld likes '-Wl,-z,ignore'. + # Sun C likes '-z ignore'. + # Don't try bare '--as-needed'; nothing likes it and the HP-UX 11.11 + # native cc issues annoying warnings and then ignores it, + # which would cause us to incorrectly conclude that it worked. + for gl_flags in \ + '-Wl,--as-needed' \ + '-Wl,-z,ignore' \ + '-z ignore' + do LDFLAGS="$gl_flags $LDFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM()], [gl_cv_ignore_unused_libraries=$gl_flags]) LDFLAGS=$gl_saved_ldflags test "$gl_cv_ignore_unused_libraries" != none && break - done]) + done + LIBS=$gl_saved_libs]) test "$gl_cv_ignore_unused_libraries" != none && LDFLAGS="$LDFLAGS $gl_cv_ignore_unused_libraries"