build: fix warnings on glibc 2.19

glibc 2.19 complains about deprecation of both _GNU_SOURCE and _SVID_SOURCE
defined. (_SVID_SOURCE comes from _BSD_SOURCE). This does a check for
glibc and only defines _GNU_SOURCE if we are on glibc. _GNU_SOURCE covers
all our bases from _BSD_SOURCE anyway.