configure: Use CFLAGS_FOR_BUILD when checking native compiler
Summary:
This fixes a bug where configure would fail or disable static
ecmult tables because it wrongly checks the native compiler using
the target CFLAGS (instead of the native CFLAGS_FOR_BUILD), and
similar for CPPFLAGS and LDFLAGS.
Moreover, this commit adds tests to figure out whether the native
compiler supports the warning flags passed during the build, and it
contains a few minor improvements to the code that checks the native
compiler.
- Actually pass CFLAGS_FOR_BUILD and LDFLAGS_FOR_BUILD to linker
This is a backport of secp256k1 PR584
It does not look like any change is required on the cmake build because it build the native eecutable in a different context altogether.
Test Plan:
make check
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D4997