On 13/03/11 09:33, Vincent Torri wrote:
On Sun, Mar 13, 2011 at 8:57 AM, Jef Driesen<jefdrie...@hotmail.com>  wrote:

On 10/03/11 11:38, Vincent Torri wrote:

You also have to support static linking.


Does pkg-config support static linking? When I tried to build my own
project, which checks for libusb using the PKG_CHECK_MODULES macro, it
doesn't seem to link statically against libusb.

My project consist of a library and a few sample applications using that
library. I ran configure as follows:

$ ./configure --disable-shared

I think that you shuld first find documentation fto understand the
difference between:

  * a statically linked library (also oftenly just named 'static library')
  * the process of linking statically a library (also oftenly just named
'static linking')

I understand the difference between the two. I just don't know how to do the static linking when autotools, libtool and pkg-config are involved.

this configure option above just disables the creation of the shared library
(yourlib.so) and builds only the static library (yourlib.a). Static linking
of a library (or program) means that you "embed" all the dependencies of
your library (or program) in your library (or program). Check out ld
documentation for more informations.

I assumed that flag would also statically link external libraries. Before my project had no dependencies on external library, so this flag did the trick and I never noticed the difference.

pkg-config supports static linking. See
http://people.freedesktop.org/~dbn/pkg-config-guide.html for example.

The question is then, how do I make use of it? I know how to use it when calling pkg-config manually (e.g. the --static option), but not in combination with autotools and libtool.

Reply via email to