fix ptrdiff_t and _GNU_SOURCE detection