I see that Jan Djärv tracked the problem down: unexmacosx.c included <unistd.h> before <config.h>, and this caused the problem. Generally speaking, <config.h> should be included before all other files, since it defines macros such as _FILE_OFFSET_BITS that may affect the ABI, and compiling files sometimes with one ABI and sometimes with another can lead to disaster.
I see that unexmacos.c still doesn't include <config.h> first, though. I suggest that it be changed to do that. A quick scan for other files with the problem show that the following files probably need the "#include <config.h>" moved to the top too: w32.c w32proc.c
