[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gl_IGNORE_UNUSED_LIBRARIES sets --as-needed on HP-UX but should not
From: |
Paul Eggert |
Subject: |
Re: gl_IGNORE_UNUSED_LIBRARIES sets --as-needed on HP-UX but should not |
Date: |
Mon, 19 Jun 2006 23:00:51 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
address@hidden (Bob Proulx) writes:
> While building coreutils on HP-UX 11.11 using the native hp c compiler
> I noticed that gnulib's gl_IGNORE_UNUSED_LIBRARIES causes --as-needed
> to be inadvertently used where it is not a valid option there. It
> does not actually break the coreutils build and is why the warnings it
> produced went undetected.
Thanks for mentioning that. I installed the following to fix this,
and to detect the problem Ralf noted.
2006-06-19 Paul Eggert <address@hidden>
* m4/lib-ignore.m4 (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).
--- m4/lib-ignore.m4 19 Jun 2006 07:19:00 -0000 1.4
+++ m4/lib-ignore.m4 20 Jun 2006 05:57:05 -0000
@@ -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"