Skip to content
17 changes: 11 additions & 6 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ construct_configure_options() {
--with-zlib \
--without-snmp"

local operating_system=$(uname -a)
local arch=$(uname -m)

if [ "$PHP_CONFIGURE_OPTIONS" = "" ]; then
local configure_options="$(os_based_configure_options) $global_config"
else
Expand All @@ -168,8 +171,6 @@ construct_configure_options() {
if [ "${PHP_WITHOUT_PDO_PGSQL:-no}" != "no" ]; then
configure_options="$configure_options"
else
local operating_system=$(uname -a)

if [[ $operating_system =~ "Darwin" ]]; then
exit_if_homebrew_not_installed

Expand All @@ -185,12 +186,16 @@ construct_configure_options() {
fi
fi

if [ "${PHP_WITHOUT_PCRE_JIT:-no}" != "no" ]; then
configure_options="$configure_options"
else
# Disable PCRE JIT either if PHP_WITHOUT_PCRE_JIT is set or an Arm-based Mac is detected
if [[ "${PHP_WITHOUT_PCRE_JIT:-no}" != "no" || ($operating_system =~ "Darwin" && $arch == "arm64")]]; then
configure_options="$configure_options --without-pcre-jit"
fi

# Disable Opcache JIT to prevent errors with capstone
if [[($operating_system =~ "Darwin" && $arch == "arm64")]]; then
configure_options="$configure_options --disable-opcache-jit"
fi

echo "$configure_options"
}

Expand Down Expand Up @@ -241,7 +246,7 @@ os_based_configure_options() {
local sodium_path=$(homebrew_package_path libsodium)

if [ -n "$gmp_path" ]; then
configure_options="--with-gmp=$gmp_path"
configure_options="$configure_options --with-gmp=$gmp_path"
else
echo "gmp not found, not including in installation"
fi
Expand Down