use correct compile flags for OSX: turn on optimization, dynamiclib