summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-03-16 12:28:47 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-03-16 12:30:56 +0100
commitfa9e2b31b88b1189e0b3d29840e3cce9f44c632d (patch)
tree1d9747eaa6a4040fbb1e5f82551e2384e7b7ccaa /build
parent9140c9038a83ff55a78f357f8485de086d83d94e (diff)
downloadphp-git-fa9e2b31b88b1189e0b3d29840e3cce9f44c632d.tar.gz
Check for php program in autoconf
Use the detected PHP (minimum 7.1) to run gen_stubs, and other code generation scripts in the future.
Diffstat (limited to 'build')
-rw-r--r--build/Makefile.global10
-rw-r--r--build/php.m424
2 files changed, 26 insertions, 8 deletions
diff --git a/build/Makefile.global b/build/Makefile.global
index 9a8779d56d..cc21973f18 100644
--- a/build/Makefile.global
+++ b/build/Makefile.global
@@ -142,17 +142,11 @@ prof-clean:
prof-use:
CCACHE_DISABLE=1 $(MAKE) PROF_FLAGS=-fprofile-use all
-# only php above 7.1.0 supports nullable return type
%_arginfo.h: %.stub.php
@if test -e "$(top_srcdir)/build/gen_stub.php"; then \
- if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
+ if test ! -z "$(PHP)" && test -x "$(PHP)"; then \
echo Parse $< to generate $@;\
- $(PHP_EXECUTABLE) $(top_srcdir)/build/gen_stub.php $<; \
- elif type php >/dev/null 2>/dev/null; then \
- if test `php -v | head -n1 | cut -d" " -f 2 | sed "s/$$/\n7.0.99/" | sort -rV | head -n1` != "7.0.99"; then \
- echo Parse $< to generate $@;\
- php $(top_srcdir)/build/gen_stub.php $<; \
- fi; \
+ $(PHP) $(top_srcdir)/build/gen_stub.php $<; \
fi; \
fi;
diff --git a/build/php.m4 b/build/php.m4
index 04651f01e2..8994e1fe6a 100644
--- a/build/php.m4
+++ b/build/php.m4
@@ -1876,6 +1876,30 @@ AC_DEFUN([PHP_PROG_RE2C],[
PHP_SUBST(RE2C)
])
+AC_DEFUN([PHP_PROG_PHP],[
+ AC_CHECK_PROG(PHP, php, php)
+
+ if test -n "$PHP"; then
+ AC_MSG_CHECKING([for php version])
+ php_version=$($PHP -v | head -n1 | cut -d ' ' -f 2)
+ if test -z "$php_version"; then
+ php_version=0.0.0
+ fi
+ ac_IFS=$IFS; IFS="."
+ set $php_version
+ IFS=$ac_IFS
+ php_version_num=`expr [$]{1:-0} \* 10000 + [$]{2:-0} \* 100 + [$]{3:-0}`
+ dnl Minimum supported version for gen_stubs.php is PHP 7.1.
+ if test "$php_version_num" -lt 70100; then
+ AC_MSG_RESULT([$php_version (too old)])
+ unset PHP
+ else
+ AC_MSG_RESULT([$php_version (ok)])
+ fi
+ fi
+ PHP_SUBST(PHP)
+])
+
dnl ----------------------------------------------------------------------------
dnl Common setup macros: PHP_SETUP_<what>
dnl ----------------------------------------------------------------------------