diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-07-10 19:38:16 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-07-10 19:38:16 +0000 |
commit | d3a8ccb8073c3d76b8bfbb4205cfddfd5a351831 (patch) | |
tree | 1bf1246ccd4da51d0977c18f69221b6d4f0a123f /libevent.pc.in | |
parent | a501d6833bae3415381e62acd6e45f4a22fea5b6 (diff) | |
download | libevent-d3a8ccb8073c3d76b8bfbb4205cfddfd5a351831.tar.gz |
Change use of AC_CHECK_LIB to AC_SEARCH_LIBS.
Patch from Zack Weinberg. His message:
This one eliminates all use of AC_CHECK_LIB in the configure script.
AC_CHECK_LIB has a serious flaw: if the library you mention *exists*
but is not *necessary* for the function you want, it adds it to
$(LIBS) anyway. This was fine in the days of static libraries,
because the linker would ignore an .a library that didn't contain
anything you needed. However, ELF shared libraries are different
(let's not get into why): the linker will by default record a
DT_NEEDED entry for every shared object mentioned on the link
command line. Thus, every use of AC_CHECK_LIB is a potential
unnecessary DT_NEEDED, making extra work for the dynamic loader. The
cure is simply to use AC_SEARCH_LIBS instead; it first tries to find
the function you ask for in libc, and only if that doesn't work does
it try to use the extra library you mention.
For the same reasons, pkg-config .pc files should distinguish
between the libraries to use for shared linkage (Libs:) and the
additional libraries needed for static linkage (Libs.private:). I
have also made that correction in this patch. I also took the
opportunity to clean up the substitution variables a little and make
absolutely sure that the core library does not get linked against
zlib.
svn:r1338
Diffstat (limited to 'libevent.pc.in')
-rw-r--r-- | libevent.pc.in | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libevent.pc.in b/libevent.pc.in index 79c38b19..7030884e 100644 --- a/libevent.pc.in +++ b/libevent.pc.in @@ -10,6 +10,7 @@ Description: libevent is an asynchronous notification event loop library Version: @VERSION@ Requires: Conflicts: -Libs: -L${libdir} -levent @LIBSOCKET@ @LIBRESOLV@ @LIBRT@ @LIBNSL@ @ZLIB_LIBS@ +Libs: -L${libdir} -levent +Libs.private: @LIBS@ Cflags: -I${includedir} |