Base library naming decisions on the stanards of the compiling OS.

This patch adds support for OS's that don't use libX.so conventions.
For example Mac OS will use libX.dylib instead. This is now detected
at compile time. A helper function to generated the library name
is provided for ease of use.