diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4 index 714a8d57e8a..7e572019548 100644 --- a/ext/pcre/config0.m4 +++ b/ext/pcre/config0.m4 @@ -68,9 +68,6 @@ else pcre2lib/pcre2_tables.c pcre2lib/pcre2_ucd.c pcre2lib/pcre2_valid_utf.c pcre2lib/pcre2_xclass.c \ pcre2lib/pcre2_find_bracket.c pcre2lib/pcre2_convert.c pcre2lib/pcre2_extuni.c pcre2lib/pcre2_script_run.c" PHP_PCRE_CFLAGS="-DHAVE_CONFIG_H -I@ext_srcdir@/pcre2lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1" - PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS) - PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib) - PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/]) AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) AC_DEFINE(PCRE2_CODE_UNIT_WIDTH, 8, [ ]) @@ -78,10 +75,31 @@ else if test "$PHP_PCRE_JIT" != "no"; then AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ]) AC_MSG_RESULT([yes]) + + AC_CACHE_CHECK([whether Intel CET is enabled], ac_cv_have_pcre2_intel_cet, [ + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([[ + #ifndef __CET__ + # error CET is not enabled + #endif + ]])], [ + ac_cv_have_pcre2_intel_cet=yes + ], [ + ac_cv_have_pcre2_intel_cet=no + ]) + if test "$ac_cv_have_pcre2_intel_cet" = yes; then + PHP_PCRE_CFLAGS="-mshstk $PHP_PCRE_CFLAGS" + fi + ]) + else AC_MSG_RESULT([no]) fi + PHP_NEW_EXTENSION(pcre, $pcrelib_sources php_pcre.c, no,,$PHP_PCRE_CFLAGS) + PHP_ADD_BUILD_DIR($ext_builddir/pcre2lib) + PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcre2lib/]) + if test "$PHP_VALGRIND" != "no" && test "$have_valgrind" = "yes"; then dnl Enable pcre valgrind support only in DEBUG build (it affects performance) if test "$ZEND_DEBUG" = "yes"; then