Added optional shared library compilation