[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] new module lib-ignore; new section build_lib in MODULES

From: Paul Eggert
Subject: Re: [bug-gnulib] new module lib-ignore; new section build_lib in MODULES.html
Date: Wed, 11 Jan 2006 10:28:55 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:

> Similarly, `-zignore' is linker dependent.

Yes.  If some linkers need some other option to do that, we'll need to
add it to lib-ignore.m4.  But in the meantime the existing code should
produce working executables, even with those linkers, since it doesn't
use -zignore unless that makes a difference in the ldd output.

>  And if I know anything about how autotools-using build systems
> expect link flags and libraries, then you're not supposed to put
> `-lrt' in LDFLAGS, but in LIBS.

Yes, that's what the lib-ignore code does; it puts -lm into LIBS in
order to test -zignore.

> Furthermore, the test looks completely bogus to me, testing a basically
> empty program: how is that going to *reliably* record the need of librt
> for a real program?

It works reliably on Solaris, for -lm.  It also works on Debian
GNU/Linux, in that it discovers that -zignore isn't needed there.  If
it breaks on some other platform then I'd like to know about it, and
I'd like to fix it.

> why doesn't gnulib allow to separate LDADD per module then, as a
> refinement?

gnulib already does that, with variables like LIB_CLOCK_GETTIME.  But
the problem is maintaining the list of LDADDs.  At the end of this
message is an extract from coreutils/src/Makefile.am.  This list is
maintained by hand, and it's error-prone.  For example, with coreutils
5.93 "ldd who" has the following output on my Solaris 8 host (64-bit):

        libnsl.so.1 =>   /usr/lib/64/libnsl.so.1
        libsocket.so.1 =>        /usr/lib/64/libsocket.so.1
        libc.so.1 =>     /usr/lib/64/libc.so.1
        libdl.so.1 =>    /usr/lib/64/libdl.so.1
        libmp.so.2 =>    /usr/lib/64/libmp.so.2

I think only libc and libdl are needed; the rest aren't.  This could
be worked around by further editing the Makefile gorp below, but it's
much better to have the linker figure it out.


# Sometimes, the expansion of $(LIBINTL) includes -lc which may
# include modules defining variables like `optind', so libcoreutils.a
# must precede $(LIBINTL) in order to ensure we use GNU getopt.
# But libcoreutils.a must also follow $(LIBINTL), since libintl uses
# replacement functions defined in libcoreutils.a.
LDADD = ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a

# for eaccess in lib/euidaccess.c.
ginstall_LDADD = $(LDADD) $(LIB_EACCESS)
# This is for the '[' program.  Automake transliterates '[' to '_'.

# for clock_gettime and fdatasync

## If necessary, add -lm to resolve use of pow in lib/strtod.c.

# for get_date and gettime

# If necessary, add -lm to resolve use of pow in lib/strtod.c.
# If necessary, add -liconv to resolve use of iconv in lib/unicodeio.c.

# If necessary, add -lm to resolve use of floor, rint, modf.

# If necessary, add libraries to resolve the `pow' reference in lib/strtod.c
# and the `nanosleep' reference in lib/xnanosleep.c.
nanosec_libs = $(LDADD) $(POW_LIB) $(LIB_NANOSLEEP)

sleep_LDADD = $(nanosec_libs)
tail_LDADD = $(nanosec_libs)



dir_LDADD += $(LIB_ACL)
ls_LDADD += $(LIB_ACL)
vdir_LDADD += $(LIB_ACL)
cp_LDADD += $(LIB_ACL)
mv_LDADD += $(LIB_ACL)
ginstall_LDADD += $(LIB_ACL)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]