Skip to content

Commit 3b78a24

Browse files
committed
make LTP version check a blacklist
1 parent bf2f80b commit 3b78a24

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

configure.in

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,12 @@ if test "$PHP_GCOV" = "yes"; then
784784
AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
785785
fi
786786

787-
ltp_version_list="1.5 1.6 1.7 1.9 1.10"
787+
dnl min: 1.5 (i.e. 105, major * 100 + minor for easier comparison)
788+
ltp_version_min="105"
789+
dnl non-working versions, e.g. "1.8 1.18";
790+
dnl remove "none" when introducing the first incompatible LTP version an
791+
dnl separate any following additions by spaces
792+
ltp_version_exclude="1.8"
788793

789794
AC_CHECK_PROG(LTP, lcov, lcov)
790795
AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
@@ -794,21 +799,30 @@ if test "$PHP_GCOV" = "yes"; then
794799
if test "$LTP"; then
795800
AC_CACHE_CHECK([for ltp version], php_cv_ltp_version, [
796801
php_cv_ltp_version=invalid
797-
ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
798-
for ltp_check_version in $ltp_version_list; do
799-
if test "$ltp_version" = "$ltp_check_version"; then
800-
php_cv_ltp_version="$ltp_check_version (ok)"
802+
ltp_version_vars=`$LTP -v 2>/dev/null | $SED -e 's/^.* //' -e 's/\./ /g' | tr -d a-z`
803+
if test -n "$ltp_version_vars"; then
804+
set $ltp_version_vars
805+
ltp_version="${1}.${2}"
806+
ltp_version_num="`expr ${1} \* 100 + ${2}`"
807+
if test $ltp_version_num -ge $ltp_version_min; then
808+
php_cv_ltp_version="$ltp_version (ok)"
809+
for ltp_check_version in $ltp_version_exclude; do
810+
if test "$ltp_version" = "$ltp_check_version"; then
811+
php_cv_ltp_version=invalid
812+
break
813+
fi
814+
done
801815
fi
802-
done
816+
fi
803817
])
804818
else
805-
ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
819+
ltp_msg="To enable code coverage reporting you must have LTP installed"
806820
AC_MSG_ERROR([$ltp_msg])
807821
fi
808822

809823
case $php_cv_ltp_version in
810824
""|invalid[)]
811-
ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
825+
ltp_msg="This LTP version is not supported (found: $ltp_version, min: $ltp_version_min, excluded: $ltp_version_exclude)."
812826
AC_MSG_ERROR([$ltp_msg])
813827
LTP="exit 0;"
814828
;;

0 commit comments

Comments
 (0)