0006-ext-pcre-config0.m4-add-ac_cv_have_pcre2_jit-variabl.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. From a9151b1a6abde8306c7b46ca52036b2dc9c1b76d Mon Sep 17 00:00:00 2001
  2. From: Artem Panfilov <panfilov.artyom@gmail.com>
  3. Date: Tue, 16 Apr 2019 12:02:05 +0300
  4. Subject: [PATCH] ext/pcre/config0.m4: add ac_cv_have_pcre2_jit variable
  5. The HAVE_PCRE_JIT_SUPPORT check uses AC_RUN_IFELSE, which is not
  6. available when cross-compiling. As a fallback, JIT support is enabled
  7. based on CPU architecture. However, this may be wrong,
  8. e.g. when the JIT the feature was not enabled in the pcre2 build.
  9. Add a cache variable for the PCRE JIT feature to make it possible to
  10. override the check.
  11. Backported from: 12ee246ae45889004fc2c099c04cfff1ce6e8848
  12. Signed-off-by: Artem Panfilov <panfilov.artyom@gmail.com>
  13. ---
  14. ext/pcre/config0.m4 | 56 +++++++++++++++++++++++----------------------
  15. 1 file changed, 29 insertions(+), 27 deletions(-)
  16. diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
  17. index b9542f0113..f964429431 100644
  18. --- a/ext/pcre/config0.m4
  19. +++ b/ext/pcre/config0.m4
  20. @@ -53,35 +53,37 @@ PHP_ARG_WITH(pcre-jit,,[ --with-pcre-jit Enable PCRE JIT functionality
  21. AC_DEFINE(HAVE_PCRE, 1, [ ])
  22. if test "$PHP_PCRE_JIT" != "no"; then
  23. - AC_MSG_CHECKING([for JIT support in PCRE2])
  24. + AC_CACHE_CHECK([for JIT support in PCRE2], ac_cv_have_pcre2_jit, [
  25. AC_RUN_IFELSE([
  26. - AC_LANG_SOURCE([[
  27. - #include <pcre2.h>
  28. - #include <stdlib.h>
  29. - int main(void) {
  30. - uint32_t have_jit;
  31. - pcre2_config_8(PCRE2_CONFIG_JIT, &have_jit);
  32. - return !have_jit;
  33. - }
  34. - ]])], [
  35. - AC_MSG_RESULT([yes])
  36. - AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [])
  37. - ],
  38. - [
  39. - AC_MSG_RESULT([no])
  40. - ],
  41. - [
  42. - AC_CANONICAL_HOST
  43. - case $host_cpu in
  44. - arm*|i[34567]86|x86_64|mips*|powerpc*|sparc)
  45. - AC_MSG_RESULT([yes])
  46. - AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [])
  47. - ;;
  48. - *)
  49. - AC_MSG_RESULT([no])
  50. - ;;
  51. - esac
  52. + AC_LANG_SOURCE([[
  53. + #include <pcre2.h>
  54. + #include <stdlib.h>
  55. + int main(void) {
  56. + uint32_t have_jit;
  57. + pcre2_config_8(PCRE2_CONFIG_JIT, &have_jit);
  58. + return !have_jit;
  59. + }
  60. + ]])], [
  61. + ac_cv_have_pcre2_jit=yes
  62. + ],
  63. + [
  64. + ac_cv_have_pcre2_jit=no
  65. + ],
  66. + [
  67. + AC_CANONICAL_HOST
  68. + case $host_cpu in
  69. + arm*|i[34567]86|x86_64|mips*|powerpc*|sparc)
  70. + ac_cv_have_pcre2_jit=yes
  71. + ;;
  72. + *)
  73. + ac_cv_have_pcre2_jit=no
  74. + ;;
  75. + esac
  76. + ])
  77. ])
  78. + if test $ac_cv_have_pcre2_jit = yes; then
  79. + AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [])
  80. + fi
  81. fi
  82. PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
  83. --
  84. 2.17.1