diff --git a/bin/install b/bin/install index a4b60c8..0bf762c 100755 --- a/bin/install +++ b/bin/install @@ -15,7 +15,7 @@ install_php() { echo "Determining configuration options..." local source_path=$(get_download_file_path $install_type $version $tmp_download_dir) - local configure_options="$(construct_configure_options $install_path)" + local configure_options="$(construct_configure_options $install_path $version)" local make_flags="-j$ASDF_CONCURRENCY" local operating_system=$(uname -a) @@ -109,8 +109,13 @@ install_composer() { $bin_path/php -r "unlink('composer-setup.php');" } +version_greater_equal() { + printf '%s\n%s\n' "$2" "$1" | sort --check=quiet --version-sort +} + construct_configure_options() { local install_path=$1 + local version=$2 # many options included below are not applicable to newer PHP versions # including these will trigger a build warning, but will not b @@ -153,6 +158,9 @@ construct_configure_options() { --with-zlib \ --without-snmp" + # opcache is bundled with php 5.5.0 and later + version_greater_equal $version "5.5.0" && global_config="$global_config --enable-opcache" + if [ "$PHP_CONFIGURE_OPTIONS" = "" ]; then local configure_options="$(os_based_configure_options) $global_config" else