[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] gettext: -lintl if necessary
From: |
Paul Eggert |
Subject: |
Re: [bug-gnulib] gettext: -lintl if necessary |
Date: |
Fri, 16 Jun 2006 11:01:33 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>> The gettext module brings in the proper -I's to make gettext calls
>> work, but doesn't bring in the library.
>
> This is normal. We specify the needed libraries for each program and
> for each shared library separately. So that, for example, in coreutils
> only those programs are linked to librt and libpthread that need it;
> only those programs are linked to libm that need it; etc. - although
> these needs arise through gnulib modules.
That's longstanding coreutils practice, but it's a maintenance hassle
and in coreutils CVS we're using a new gl_IGNORE_UNUSED_LIBRARIES
macro (defined in m4/lib-ignore.m4) that tells the linker to omit
references to libraries that are not actually used (this is the '-z
ignore' option of the Solaris linker).
At some point I was going to propose to move this into gnulib.
Here's the source code, to save you the hassle of looking it up.
# If possible, ignore libraries that are not depended on.
dnl Copyright (C) 2006 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.
dnl Written by Paul Eggert.
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
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
LDFLAGS="$gl_flags $LDFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
[gl_cv_ignore_unused_libraries=$gl_flags])
LDFLAGS=$gl_saved_ldflags
test "$gl_cv_ignore_unused_libraries" != none && break
done])
test "$gl_cv_ignore_unused_libraries" != none &&
LDFLAGS="$LDFLAGS $gl_cv_ignore_unused_libraries"
])