Change ifdef to check for __GLIBC__ instead of __linux__ to prevent errors when building under other libc's

This fixes issue #1956