Fix building as either static or shared library