config0.m4 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. dnl By default we'll compile and link against the bundled PCRE library. If
  2. dnl --with-external-pcre is supplied, we'll use that for linking.
  3. PHP_ARG_WITH([external-pcre],,
  4. [AS_HELP_STRING([--with-external-pcre],
  5. [Use external library for PCRE support])],
  6. [no],
  7. [no])
  8. PHP_ARG_WITH([pcre-jit],,
  9. [AS_HELP_STRING([--without-pcre-jit],
  10. [Disable PCRE JIT functionality])],
  11. [yes],
  12. [no])
  13. if test "$PHP_EXTERNAL_PCRE" != "no"; then
  14. PKG_CHECK_MODULES([PCRE2], [libpcre2-8 >= 10.30])
  15. PHP_EVAL_INCLINE($PCRE2_CFLAGS)
  16. PHP_EVAL_LIBLINE($PCRE2_LIBS)
  17. AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
  18. if test "$PHP_PCRE_JIT" != "no"; then
  19. AC_CACHE_CHECK([for JIT support in PCRE2], ac_cv_have_pcre2_jit, [
  20. AC_RUN_IFELSE([
  21. AC_LANG_SOURCE([[
  22. #include <pcre2.h>
  23. #include <stdlib.h>
  24. int main(void) {
  25. uint32_t have_jit;
  26. pcre2_config_8(PCRE2_CONFIG_JIT, &have_jit);
  27. return !have_jit;
  28. }
  29. ]])], [
  30. ac_cv_have_pcre2_jit=yes
  31. ],
  32. [
  33. ac_cv_have_pcre2_jit=no
  34. ],
  35. [
  36. AC_CANONICAL_HOST
  37. case $host_cpu in
  38. arm*|i[[34567]]86|x86_64|mips*|powerpc*|sparc)
  39. ac_cv_have_pcre2_jit=yes
  40. ;;
  41. *)
  42. ac_cv_have_pcre2_jit=no
  43. ;;
  44. esac
  45. ])
  46. ])
  47. if test $ac_cv_have_pcre2_jit = yes; then
  48. AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [])
  49. fi
  50. fi
  51. PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
  52. PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h])
  53. else
  54. AC_MSG_CHECKING([for PCRE library to use])
  55. AC_MSG_RESULT([bundled])
  56. pcrelib_sources="pcre2lib/pcre2_auto_possess.c pcre2lib/pcre2_chartables.c pcre2lib/pcre2_compile.c \
  57. pcre2lib/pcre2_config.c pcre2lib/pcre2_context.c pcre2lib/pcre2_dfa_match.c pcre2lib/pcre2_error.c \
  58. pcre2lib/pcre2_jit_compile.c pcre2lib/pcre2_maketables.c pcre2lib/pcre2_match.c pcre2lib/pcre2_match_data.c \
  59. pcre2lib/pcre2_newline.c pcre2lib/pcre2_ord2utf.c pcre2lib/pcre2_pattern_info.c pcre2lib/pcre2_serialize.c \
  60. pcre2lib/pcre2_string_utils.c pcre2lib/pcre2_study.c pcre2lib/pcre2_substitute.c pcre2lib/pcre2_substring.c \
  61. pcre2lib/pcre2_tables.c pcre2lib/pcre2_ucd.c pcre2lib/pcre2_valid_utf.c pcre2lib/pcre2_xclass.c \
  62. pcre2lib/pcre2_find_bracket.c pcre2lib/pcre2_convert.c pcre2lib/pcre2_extuni.c pcre2lib/pcre2_script_run.c"
  63. PHP_PCRE_CFLAGS="-Wno-implicit-fallthrough -DHAVE_CONFIG_H -I@ext_srcdir@/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
  64. AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
  65. AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ])
  66. AC_MSG_CHECKING([whether to enable PCRE JIT functionality])
  67. if test "$PHP_PCRE_JIT" != "no"; then
  68. AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ])
  69. AC_MSG_RESULT([yes])
  70. AC_CACHE_CHECK([whether Intel CET is enabled], ac_cv_have_pcre2_intel_cet, [
  71. AC_COMPILE_IFELSE([
  72. AC_LANG_SOURCE([[
  73. #ifndef __CET__
  74. # error CET is not enabled
  75. #endif
  76. ]])], [
  77. ac_cv_have_pcre2_intel_cet=yes
  78. ], [
  79. ac_cv_have_pcre2_intel_cet=no
  80. ])
  81. if test "$ac_cv_have_pcre2_intel_cet" = yes; then
  82. PHP_PCRE_CFLAGS="-mshstk $PHP_PCRE_CFLAGS"
  83. fi
  84. ])
  85. else
  86. AC_MSG_RESULT([no])
  87. fi
  88. PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS)
  89. PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib)
  90. PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/])
  91. if test "$PHP_VALGRIND" != "no" && test "$have_valgrind" = "yes"; then
  92. dnl Enable pcre valgrind support only in DEBUG build (it affects performance)
  93. if test "$ZEND_DEBUG" = "yes"; then
  94. AC_DEFINE(HAVE_PCRE_VALGRIND_SUPPORT, 1, [ ])
  95. fi
  96. fi
  97. fi