Hi Bruno, bug-gnulib readers,
In general, $LIBS needs to be prepended to, not appended, to allow for
static linking to succeed in the presence of deplibs already in $LIBS.
With specific libraries, the issue _may_ be different, but only very
rarely so[1]. This is why the patch below handles only the general
lib-link behavior and not the other gnulib macros that change $LIBS.
I have not audited AC_LIB_LINKFLAGS_BODY for more hidden instances of
this issue. :)
Cheers,
Ralf
[1] Usually only with either circular dependencies, in which case all
interdepending libs should be treated together, or with system-level
libraries, which are either guaranteed to not require anything from
$LIBS, or which _need_ to have their unresolved symbols resolved from
libs provided by the compiler driver and may otherwise wrongly get them
from other libraries. The last situation is ugly, I don't know of any
real-world examples, though.
* lib-link.m4 (AC_LIB_HAVE_LINKFLAGS): Prepend to $LIBS,
not append.
Index: m4/lib-link.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/lib-link.m4,v
retrieving revision 1.11
diff -u -r1.11 lib-link.m4
--- m4/lib-link.m4 2 Sep 2005 11:20:50 -0000 1.11
+++ m4/lib-link.m4 14 Sep 2005 12:44:59 -0000
@@ -66,7 +66,7 @@
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
ac_save_LIBS="$LIBS"
- LIBS="$LIBS $LIB[]NAME"
+ LIBS="$LIB[]NAME $LIBS"
AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
LIBS="$ac_save_LIBS"
])
_______________________________________________
bug-gnulib mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnulib