build: use a configure option to enable extra build checks & format errors
This moves the checks from CFLAGS to proper checks in the configure phase.
This also adds -Werror=format
to spot printf string mismatched (this helped me a few times).
And properly check the C++ compiler flags.
v2:
- fix the formatting errors found in v1 builds
- add extra checks on all targets build by the CI
Edited by Steve Lhomme