Change linker flags for building shared library
Add linux and MAcOSX build.