cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: pkgconfig and libs

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 31 Oct 2006 15:21:39 -0800

On Tue, Oct 31, 2006 at 11:09:23PM +0100, Daniel Stenberg wrote:
> I noticed this little patch in Redhat's bugtracker[*] for curl and I wanted
> to hear if there's someone who knows about or use pkgconfig that can
> comment on its merits:
>
> --- curl-7.16.0/libcurl.pc.in.LIBS_PRIVATE 2004-12-11
> 12:46:40.000000000 -0600
> +++ curl-7.16.0/libcurl.pc.in 2006-10-31 10:05:30.000000000 -0600
> @@ -6,5 +6,6 @@
> Name: libcurl
> Description: Library to transfer files with ftp, http, etc.
> Version: @VERSION@
> -Libs: -L${libdir} -lcurl @LDFLAGS@ @LIBS@
> +Libs: -L${libdir} -lcurl
> +Libs.private: @LDFLAGS@ @LIBS@
> Cflags: -I${includedir}

I've been thinking about this problem lately, too, since it's really the
same problem as curl-config giving out unnecessary flags used by configure
to applications (like SSL libs, etc.). On most modern systems those flags
aren't necessary as ELF objects hold the inter-library dependencies that
the linker can use to do its thing.

My current thinking is to change the output of curl-config --libs and
libcurl.pc to just what Red Hat has done, i.e. -L/path/to/lib -lcurl, by
default, ignoring all the other linker flags needed by configure or
libcurl itself. That solves the Linux Standards Base problem that came
up here a few weeks ago, allowing an application to link to libcurl
regardless of whether libcurl is itself linked to GnuTLS or OpenSSL, etc.

For systems that don't support inter-library dependencies, that won't
work as all the necessary libraries will need to be explicitly linked
by the app. autoconf could be used to determine such a system (there
might be a libtool macro that will help here) and add all those flags
when it's required, essentially making the output of curl-config identical
to what it is today.

There will also be problems with application that want to link libcurl
statically. Red Hat's changes above fix that by putting the library flags
required for static linking into Libs.private; that's what pkg-config
>= 0.18 returns if the --static flag is requested. If you want curl-config
to support the static linking case cleanly, then you'll have to add a
similar option to it.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2006-11-01