Add PHP version check in config.m4
We may need to do the same check in config.w32
@@ -8,6 +8,15 @@ PHP_ARG_ENABLE([swow],
if test "${SWOW}" != "no"; then
+ AC_MSG_CHECKING([Check for supported PHP versions])
+ PHP_VERSION=`${PHP_CONFIG} --version`
+ PHP_VERSION_ID=`echo "${PHP_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'`
+ if test "${PHP_VERSION_ID}" -lt "70200" || test "${PHP_VERSION_ID}" -ge "80200"; then
+ AC_MSG_ERROR([not supported. Need a PHP version >= 7.2.0 and < 8.2.0 (found $PHP_VERSION)])
+ else
+ AC_MSG_RESULT([supported ($PHP_VERSION)])
+ fi
+
AC_DEFINE([HAVE_SWOW], 1, [Have Swow])
PHP_ARG_ENABLE([swow-debug],
