Fix for issue where GCC defines _GNU_SOURCE

I'm not sure why but some builds of GCC define _GNU_SOURCE. If it's defined again it errors out. I
added if's for define _GNU_SOURCE so it will build with those versions of GCC (like mine).