Various changes:
- Don't check $GCC and $GXX
- Prefer -Og instead of -O0
- If -g3 isn't available, use -g
This also incidentally fixes compiler warnings with GCC and glibc when
using
--enable-debug, as the old default values mixed poorly with the
hardening flags.
Backport of core PR13005
This is a follow-up for D2556
Note: there is a dependency which is not backported here, and provides
gprof support. As it is not related with this diff, and likely no one is
running gprof, I prefer not backporting it. It can always be added later
if necessary.