Backport of secp256k1#1152:
https://github.com/bitcoin-core/secp256k1/pull/1152/commits/c0ae48c9950a908b637bff27791fabbe2833c4a5
The second commit is not applicable.
Depends on D12960.
This will unbreak the build on Cirrus CI, following the MacOS Intel deprecation:
https://cirrus-ci.org/blog/2022/11/08/sunsetting-intel-macos-instances/