summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-06-20 05:59:16 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-06-20 05:59:16 +0000
commitc88873d3a48127eb6252faf586a0026b091e3628 (patch)
treeb9cf2bbaeca2141369ea528583db07cc6eefa0b1 /m4
parentd5a9087fb1d3b13243ad83d174fa1b1d0b0173c1 (diff)
downloadcoreutils-c88873d3a48127eb6252faf586a0026b091e3628.tar.xz
(gl_IGNORE_UNUSED_LIBRARIES):
Use -Wl,--as-needed, not bare --as-needed, since HP-UX 11.11 cc merely issues a bunch of annoying warnings for --as-needed (this problem was reported by Bob Proulx). Also, try linking with -lm to detect a bug in binutils 2.16 (this problem was reported by Ralf Wildenhues).
Diffstat (limited to 'm4')
-rw-r--r--m4/ChangeLog5
-rw-r--r--m4/lib-ignore.m414
2 files changed, 17 insertions, 2 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog
index 8ad70a2ee..f31ec45f7 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -3,6 +3,11 @@
* 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>.
+ However, use -Wl,--as-needed, not bare --as-needed, since HP-UX 11.11
+ cc merely issues a bunch of annoying warnings for --as-needed
+ (this problem was reported by Bob Proulx). Also, try linking with
+ -lm to detect a bug in binutils 2.16 (this problem was reported
+ by Ralf Wildenhues).
2006-06-18 Jim Meyering <jim@meyering.net>
diff --git a/m4/lib-ignore.m4 b/m4/lib-ignore.m4
index deaaee8e6..e518f8113 100644
--- a/m4/lib-ignore.m4
+++ b/m4/lib-ignore.m4
@@ -13,12 +13,21 @@ 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
+ # <http://lists.gnu.org/archive/html/bug-gnulib/2006-06/msg00131.html>.
+ 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' \
- '--as-needed' \
'-z ignore'
do
LDFLAGS="$gl_flags $LDFLAGS"
@@ -26,7 +35,8 @@ AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES],
[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"