abrasive/shairport — pull request #230 by plietar (2013-06-24 09:21:44+00:00)
Title: Detect supported audio output drivers at runtime

Currently, shairport is dynamically linked to multiple audio output libraries, such as libpulse, or libao.
Whether or not support for these libraries is built is determined at build time, depending on the presence or not of development packages of the library.

I think it would be better to have a binary that supports all existing drivers supported by the os (obviously not alsa on osx for example), and determine at run-time if the library is available.
This would allow to have a single binary, which could be distributed in a deb or an rpm file, but not require all the libraries on the computer on which it is installed.

Two methods come to my mind :
* Build the output drivers in seperate '.so' files, and load them as plugins using dlopen and dlsym. This allows to add more drivers without rebuilding everything (not really important though, total build time is 10sec)
* Build the output drivers inside the shairport binary, and use the audio libraries with dlopen and dlsym, if they are installed. This makes drivers a bit more complex to write, but requires a single binary file.

I think the second solution is the best, I like the idea of a single file.
What's your opinion ? I'm willing to do it.