mikebrady/shairport-sync — pull request #18 by yann-morin-1998 (2014-11-29 16:39:43+00:00)
Title: Fix static linking (branch yem/static-link)

Hello!

This few patches makes it possible to statically link shairport-sync.

The issues were found using [Buildroot](http://buildroot.org/). We have [autobuilders](http://autobuild.buildroot.org/) that do a lot of different builds a day, with a lot of toolchain combinations (glibc/uClibc/musl, static/shared, x86/arm/mips/..., threads/no-threads, and so on...)

Some of the builds of shairport-sync are [failing](http://autobuild.buildroot.org/?reason=shairport-sync-2.1.8) because shairport-sync fails to account for extra dependencies of some libraries. For example, -lssl needs to be linked with -lz, which is dealt with in shared builds, thanks to DT_NEEDED ELF tags, but is missing for static builds, since there is no way to have DT_NEEDED in a static library.

Instead of using AC_CHECK_LIB, use pkg-config via PKG_CHECK_MODULES to find the needed libraries, which erturns all the depending libraries if any.

Note that I fixed those libraries I had issues with, and that some may be left around. Hopefully, the provided patches can serve as an example of what should be done to the other libraries. ;-)

Thank you! :-)

Regards,
Yann E. MORIN.