package/php: fix how external PCRE2 JIT is enabled
PATCH v3 1/1 package/php: fix how external PCRE2 JIT is enabled
This patch adds ac_cv_have_pcre2_jit cache variable to avoid the tests running on the host system during cross-compiling.
Signed-off-by Artem Panfilov <[email protected]>
---
Changes v1 -> v2:
- add autoconf cache variable (suggested by Thomas Petazzoni)
Changes v2 -> v3:
- backport upstream patch (suggested by Arnout Vandecappelle)
--- ....m4-add-ac_cv_have_pcre2_jit-variabl.patch | 91 +++++++++++++++++++ package/php/php.mk | 9 ++ 2 files changed, 100 insertions(+) create mode 100644 package/php/0006-ext-pcre-config0.m4-add-ac_cv_have_pcre2_jit-variabl.patch
package/php/0006-ext-pcre-config0.m4-add-ac_cv_have_pcre2_jit-variabl.patch new file +91 -0
@@ -0,0 +1,91 @@ +From a9151b1a6abde8306c7b46ca52036b2dc9c1b76d Mon Sep 17 00:00:00 2001 +From: Artem Panfilov <[email protected]> +Date: Tue, 16 Apr 2019 12:02:05 +0300 +Subject: [PATCH] ext/pcre/config0.m4: add ac_cv_have_pcre2_jit variable + +The HAVE_PCRE_JIT_SUPPORT check uses AC_RUN_IFELSE, which is not +available when cross-compiling. As a fallback, JIT support is enabled +based on CPU architecture. However, this may be wrong, +e.g. when the JIT the feature was not enabled in the pcre2 build. + +Add a cache variable for the PCRE JIT feature to make it possible to +override the check. + +Backported from: 12ee246ae45889004fc2c099c04cfff1ce6e8848 +Signed-off-by: Artem Panfilov <[email protected]> +--- + ext/pcre/config0.m4 | 56 +++++++++++++++++++++++---------------------- + 1 file changed, 29 insertions(+), 27 deletions(-) + +diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4 +index b9542f0113..f964429431 100644 +--- a/ext/pcre/config0.m4 ++++ b/ext/pcre/config0.m4 +@@ -53,35 +53,37 @@ PHP_ARG_WITH(pcre-jit,,[ --with-pcre-jit Enable PCRE JIT functionality + AC_DEFINE(HAVE_PCRE, 1, [ ]) + + if test "$PHP_PCRE_JIT" != "no"; then +- AC_MSG_CHECKING([for JIT support in PCRE2]) ++ AC_CACHE_CHECK([for JIT support in PCRE2], ac_cv_have_pcre2_jit, [ + AC_RUN_IFELSE([ +- AC_LANG_SOURCE([[ +- #include <pcre2.h> +- #include <stdlib.h> +- int main(void) { +- uint32_t have_jit; +- pcre2_config_8(PCRE2_CONFIG_JIT, &have_jit); +- return !have_jit; +- } +- ]])], [ +- AC_MSG_RESULT([yes]) +- AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, []) +- ], +- [ +- AC_MSG_RESULT([no]) +- ], +- [ +- AC_CANONICAL_HOST +- case $host_cpu in +- arm*|i[34567]86|x86_64|mips*|powerpc*|sparc) +- AC_MSG_RESULT([yes]) +- AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, []) +- ;; +- *) +- AC_MSG_RESULT([no]) +- ;; +- esac ++ AC_LANG_SOURCE([[ ++ #include <pcre2.h> ++ #include <stdlib.h> ++ int main(void) { ++ uint32_t have_jit; ++ pcre2_config_8(PCRE2_CONFIG_JIT, &have_jit); ++ return !have_jit; ++ } ++ ]])], [ ++ ac_cv_have_pcre2_jit=yes ++ ], ++ [ ++ ac_cv_have_pcre2_jit=no ++ ], ++ [ ++ AC_CANONICAL_HOST ++ case $host_cpu in ++ arm*|i[34567]86|x86_64|mips*|powerpc*|sparc) ++ ac_cv_have_pcre2_jit=yes ++ ;; ++ *) ++ ac_cv_have_pcre2_jit=no ++ ;; ++ esac ++ ]) + ]) ++ if test $ac_cv_have_pcre2_jit = yes; then ++ AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, []) ++ fi + fi + + PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) +-- +2.17.1 +
package/php/php.mk +9 -0
@@ -246,6 +246,15 @@ PHP_POST_CONFIGURE_HOOKS += PHP_DISABLE_VALGRIND ifeq ($(BR2_PACKAGE_PCRE2),y) PHP_CONF_OPTS += --with-pcre-regex=$(STAGING_DIR)/usr PHP_DEPENDENCIES += pcre2 + +ifeq ($(BR2_PACKAGE_PCRE2_JIT),y) +PHP_CONF_OPTS += --with-pcre-jit=yes +PHP_CONF_ENV += ac_cv_have_pcre2_jit=yes +else +PHP_CONF_OPTS += --with-pcre-jit=no +PHP_CONF_ENV += ac_cv_have_pcre2_jit=no +endif + else # The bundled pcre library is not configurable through ./configure options, # and by default is configured to be thread-safe, so it wants pthreads. So
Signature · 1 line
2.17.1
Thomas Petazzoni
AppliedPATCH v3 1/1 package/php: fix how external PCRE2 JIT is enabled
Quoted 10 lines · On Tue, 16 Apr 2019 19:03:23 +0300 Artem Panfilov <[email protected]>…
This patch adds
ac_cv_have_pcre2_jitcache variable to avoid the tests running on the host system during cross-compiling.Signed-off-by Artem Panfilov <[email protected]>---
Changes v1 -> v2:
- add autoconf cache variable (suggested by Thomas Petazzoni)
Changes v2 -> v3:
- backport upstream patch (suggested by Arnout Vandecappelle)
Quoted 5 lines
--- ....m4-add-ac_cv_have_pcre2_jit-variabl.patch | 91 +++++++++++++++++++ package/php/php.mk | 9 ++ 2 files changed, 100 insertions(+) create mode 100644 package/php/0006-ext-pcre-config0.m4-add-ac_cv_have_pcre2_jit-variabl.patch
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com