build: use __EXTENSIONS__ and _XOPEN_SOURCE_EXTENDED everywhere

It is needed for Solaris and HP-UX. It doesn't seem to harm other
platforms. Let's hope that the autoconf test will catch
problems. Otherwise, we can still conditionally use them.