GCC 4.7.0 doesn't automatically include <unistd.h>
The attached patch just removes the HAIKU #ifdefs, so this header is always included. I think headers should be always included even if the compiler automatically includes them, because you can't count on newer compilers doing the same thing. Not doing so results exactly in this type of breakages that happens with almost every major version of gcc.
Of course feel free to change it in any way, especially if explicit including of <unistd.h> breaks compilation on other compilers.