[Zlib-devel] [PATCH] mingw zlib import library name
John Bowler
jbowler at frontiernet.net
Fri Apr 30 15:09:36 EDT 2010
From: Enrico Weigelt
>One thing we *could* do is providing to .pc files, one for
>dynamic and one for static - so importing packages can make
>this decision on the pkg-config query.
Generally there is only one .pc file, and inventing a new one has exactly the same problems as inventing a new name for the dynamic library. (I.e. build scripts assume they know the name of the zlib .pc file - it's zlib.pc - and don't have support for other names.)
-config files support static linking, because -config files have a '--static' option, but it doesn't necessarily do what you might expect; I just checked:
libpng-config --libs
-lpng15
libpng-config --static --libs
-lpng15 -lz
(The change is because a static link needs to explicitly add -lz to the command line, whereas the DLL of libpng is explicitly linked itself to zlib.)
In other words the --static option here just gets the correct options if --static is *also* passed to ld.
In general on UNIX systems the choice is all or nothing - it's not possible to cherry pick static libraries. I've never heard anyone complain about this before but I believe it's possible to work round it by explicitly listing the full archive path name on both UNIX and Windows (but I haven't checked that /usr/lib/libz.a will actually not get mapped to /lib/libz.so, for example.)
John Bowler <jbowler at acm.org>
More information about the Zlib-devel
mailing list