[API/FIX] add FreeBSD support to build system

Tested on FreeBSD 10.0. Both gcc49 and system compiler (clang with libc++) tested.