Fix openssl detection on Silicon Macs #1791
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Targeting 1.21 for this change, as it could lead to a different SSL library being picked, which I wouldn't expect in a patch release. This is consistent with #1463 which was the original attempt to prefer openssl over Secure Transport and also targeted a minor version to avoid unexpected issues on a patch update.
On Silicon Macs, the paths for homebrew have changed, so if the
PKG_CHECK_MODULES
macro does not find openssl on MacOS and noOPENSSL_DIR
option has been provided, it usually won't be found. As a result, Secure Transport will be picked in those circumstances.On Silicon platforms, homebrew installs openssl into
/opt/homebrew/opt/openssl
, so adding that path toPHP_OPENSSL_DIR
fixes the issue.To make debugging easier, I also added the selected SSL library to the configure output.
NB: I checked whether pkg-config is available on my system, and it isn't by default. A quick search through homebrew also didn't reveal it, so my assumption is that pkg-config won't be available on the typical developer machine, hence this workaround.