[BUILD] Search and include OpenSSL only where required
Summary:
Since D6242 there is no more OpenSSL needed outside of the BIP70
feature. This diff cleans up the build system to reflect this.
Inspired by
https://github.com/bitcoin/bitcoin/pull/17165/commits/fcee10c2d028cba11416d902f5abf13fea7a65f4
and https://github.com/bitcoin/bitcoin/pull/17265/commits/8983ee3e6dd8ab658bd2caf97c326cc53ea50818,
but obviously different because we maintain BIP70.
Depends on D6251.
Test Plan:
ninja all check-all bench-bitcoin make make check
Run the Gitian builds.
Uninstall OpenSSL (or make it fail to be found), then:
cmake -GNinja .. \ -DENABLE_BIP70=OFF \ -DSECP256K1_BUILD_OPENSSL_TESTS=OFF ninja all check-all
With autotools, the whole secp256k1 test suite should be disabled in
order to skip openssl detection. Unfortunately the option name collides
with the bitcoin abc option to disable the tests, so they end up to be
all disabled.
../configure \ --enable-deprecated-build-system \ --disable-bip70 \ --enable-tests=no make
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Subscribers: deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D6243