Albert Chin <[EMAIL PROTECTED]> writes: > --as-needed.
Thanks for mentioning that. I assumed that since binutils "ld -z ignore" worked, that it paid attention to the "-z ignore" option. It doesn't; it ignores it (:-). I just now verified this by inspecting the source code; there is undocumented support for emulating Solaris-style ld -z directives, but -z ignore is merely ignored. The original lib-ignore.m4 didn't have this problem because it used 'ldd' to verify that -z ignore actually ignored. However, 'ldd' was not portable enough, so I removed 'ldd' (see <http://lists.gnu.org/archive/html/bug-coreutils/2006-01/msg00132.html>) and that is what introduced the problem. I installed this patch into coreutils. 2006-06-19 Paul Eggert <[EMAIL PROTECTED]> * m4/lib-ignore.m4 (gl_IGNORE_UNUSED_LIBRARIES): Prefer binutils's --as-needed option if available. Problem reported by Albert Chin in <http://lists.gnu.org/archive/html/bug-gnulib/2006-06/msg00114.html>. --- m4/lib-ignore.m4 21 Jan 2006 07:59:22 -0000 1.3 +++ m4/lib-ignore.m4 19 Jun 2006 07:19:00 -0000 1.4 @@ -15,7 +15,12 @@ AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES], gl_saved_ldflags=$LDFLAGS # 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 + for gl_flags in \ + '-Wl,--as-needed' \ + '-Wl,-z,ignore' \ + '--as-needed' \ + '-z ignore' + do LDFLAGS="$gl_flags $LDFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM()], [gl_cv_ignore_unused_libraries=$gl_flags])