X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Flib-ignore.m4;h=0236cb545265cd880e2d577f33d394c9d4d893a4;hb=fc80165c92e8b92da6e88e4fdb9c472125124fa0;hp=319cf987a2b3ff4307501390ceb3a912ed57e201;hpb=14bf04a59fbfa9ae7a9b55f7885ed96a5f0341ac;p=gnulib.git diff --git a/m4/lib-ignore.m4 b/m4/lib-ignore.m4 index 319cf987a..0236cb545 100644 --- a/m4/lib-ignore.m4 +++ b/m4/lib-ignore.m4 @@ -1,6 +1,6 @@ # If possible, ignore libraries that are not depended on. -dnl Copyright (C) 2006 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,31 +12,31 @@ AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES], AC_CACHE_CHECK([for flag to ignore unused libraries], [gl_cv_ignore_unused_libraries], [gl_cv_ignore_unused_libraries=none - AC_LINK_IFELSE([AC_LANG_PROGRAM()], - [gl_ldd_output0=`(ldd conftest$ac_exeext) 2>/dev/null` || - gl_ldd_output0=]) - if test "$gl_ldd_output0"; then - gl_saved_ldflags=$LDFLAGS - gl_saved_libs=$LIBS - LIBS="$LIBS -lm" + 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. + # 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_ldd_output1=`(ldd conftest$ac_exeext) 2>/dev/null` || - gl_ldd_output1=]) - if test "$gl_ldd_output1" && test "$gl_ldd_output0" != "$gl_ldd_output1" - then - for gl_flags in '-Xlinker -zignore' '-zignore'; do - LDFLAGS="$gl_flags $LDFLAGS" - AC_LINK_IFELSE([AC_LANG_PROGRAM()], - [if gl_ldd_output2=`(ldd conftest$ac_exeext) 2>/dev/null` && - test "$gl_ldd_output0" = "$gl_ldd_output2"; then - gl_cv_ignore_unused_libraries=$gl_flags - fi]) - LDFLAGS=$gl_saved_ldflags - test "gl_cv_ignore_unused_libraries" != none && break - done - fi - LIBS=$gl_saved_LIBS - fi]) + [gl_cv_ignore_unused_libraries=$gl_flags]) + LDFLAGS=$gl_saved_ldflags + test "$gl_cv_ignore_unused_libraries" != none && break + done + LIBS=$gl_saved_libs]) test "$gl_cv_ignore_unused_libraries" != none && LDFLAGS="$LDFLAGS $gl_cv_ignore_unused_libraries"