This determines at cmake time if the main needs to be provided rather than relying on the compiler preprocessor definitions.
Backport of core#20065 and core#21080[[https://github.com/bitcoin/bitcoin/pull/20065 | core#20065]] and [[https://github.com/bitcoin/bitcoin/pull/21080 | core#21080]].