Set link flags conditionally

Add OS X frameworks needed for correct linking.