fixing compilation on OSX

define _POSIX_C_SOURCE 200809L breaks compilation with external
memstream, adding #ifndef DARWIN for OSX