@@ -6,53 +6,44 @@ PHP_ARG_WITH([external-pcre],,
66 [ no] ,
77 [ no] )
88
9- PHP_ARG_WITH([ pcre-jit] ,,
9+ PHP_ARG_WITH([ pcre-jit] ,
10+ [ whether to enable PCRE JIT functionality] ,
1011 [ AS_HELP_STRING ( [ --without-pcre-jit] ,
1112 [ Disable PCRE JIT functionality] ) ] ,
1213 [ yes] ,
1314 [ no] )
1415
15- if test "$PHP_EXTERNAL_PCRE" != "no"; then
16+ AH_TEMPLATE ( [ HAVE_PCRE_JIT_SUPPORT] ,
17+ [ Define to 1 if PCRE JIT is enabled and supported.] )
1618
19+ if test "$PHP_EXTERNAL_PCRE" != "no"; then
1720 PKG_CHECK_MODULES([ PCRE2] , [ libpcre2-8 >= 10.30] )
1821
1922 PHP_EVAL_INCLINE($PCRE2_CFLAGS)
2023 PHP_EVAL_LIBLINE($PCRE2_LIBS)
2124 AC_DEFINE ( PCRE2_CODE_UNIT_WIDTH , 8 , [ ] )
2225
23- if test "$PHP_PCRE_JIT" != "no"; then
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_cv_have_pcre2_jit=yes
36- ] ,
37- [
38- ac_cv_have_pcre2_jit=no
39- ] ,
40- [
41- AC_CANONICAL_HOST
42- case $host_cpu in
43- arm*|i[ [ 34567] ] 86|x86_64|mips*|powerpc*|sparc)
44- ac_cv_have_pcre2_jit=yes
45- ;;
46- *)
47- ac_cv_have_pcre2_jit=no
48- ;;
49- esac
50- ] )
51- ] )
52- if test $ac_cv_have_pcre2_jit = yes; then
53- AC_DEFINE ( HAVE_PCRE_JIT_SUPPORT , 1 , [ ] )
54- fi
55- fi
26+ AS_VAR_IF ( [ PHP_PCRE_JIT] , [ no] ,,
27+ [ AC_CACHE_CHECK ( [ whether external PCRE2 library has JIT supported] ,
28+ [ php_cv_have_pcre2_jit] ,
29+ [ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [
30+ #include <pcre2.h>
31+ #include <stdlib.h>
32+ int main(void) {
33+ uint32_t have_jit;
34+ pcre2_config_8(PCRE2_CONFIG_JIT, &have_jit);
35+ return !have_jit;
36+ }
37+ ] ) ] ,
38+ [ php_cv_have_pcre2_jit=yes] ,
39+ [ php_cv_have_pcre2_jit=no] ,
40+ [ AS_CASE ( [ $host_cpu] ,
41+ [ arm*|i[ [ 34567] ] 86|x86_64|mips*|powerpc*|sparc] ,
42+ [ php_cv_have_pcre2_jit=yes] ,
43+ [ php_cv_have_pcre2_jit=no] ) ] ) ] )
44+ AS_VAR_IF ( [ php_cv_have_pcre2_jit] , [ yes] ,
45+ [ AC_DEFINE ( [ HAVE_PCRE_JIT_SUPPORT] , [ 1] ) ] )
46+ ] )
5647
5748 PHP_NEW_EXTENSION(pcre, php_pcre.c, no,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
5849 PHP_INSTALL_HEADERS([ ext/pcre] , [ php_pcre.h] )
7061 AC_DEFINE ( HAVE_BUNDLED_PCRE , 1 , [ ] )
7162 AC_DEFINE ( PCRE2_CODE_UNIT_WIDTH , 8 , [ ] )
7263
73- AC_MSG_CHECKING ( [ whether to enable PCRE JIT functionality] )
74- if test "$PHP_PCRE_JIT" != "no"; then
75- AC_DEFINE ( HAVE_PCRE_JIT_SUPPORT , 1 , [ ] )
76- AC_MSG_RESULT ( [ yes] )
77-
78- AC_CACHE_CHECK ( [ whether Intel CET is enabled] , ac_cv_have_pcre2_intel_cet , [
79- AC_COMPILE_IFELSE ( [
80- AC_LANG_PROGRAM ( [ [
64+ AS_VAR_IF ( [ PHP_PCRE_JIT] , [ no] ,,
65+ [ AC_DEFINE ( [ HAVE_PCRE_JIT_SUPPORT] , [ 1] )
66+ AC_CACHE_CHECK ( [ whether Intel CET is enabled] ,
67+ [ php_cv_have_pcre2_intel_cet] ,
68+ [ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM ( [
8169 #ifndef __CET__
8270 # error CET is not enabled
8371 #endif
84- ] ] ) ] , [
85- ac_cv_have_pcre2_intel_cet=yes
86- ] , [
87- ac_cv_have_pcre2_intel_cet=no
88- ] )
72+ ] ) ] ,
73+ [ php_cv_have_pcre2_intel_cet=yes] ,
74+ [ php_cv_have_pcre2_intel_cet=no] )
8975 ] )
90- if test "$ac_cv_have_pcre2_intel_cet" = yes; then
91- PHP_PCRE_CFLAGS="-mshstk $PHP_PCRE_CFLAGS"
92- fi
93-
94- else
95- AC_MSG_RESULT ( [ no] )
96- fi
76+ AS_VAR_IF ( [ php_cv_have_pcre2_intel_cet] , [ yes] ,
77+ [ PHP_PCRE_CFLAGS="-mshstk $PHP_PCRE_CFLAGS"] )
78+ ] )
9779
9880 dnl Enable pcre Valgrind support only in DEBUG build (it affects performance).
9981 AS_VAR_IF ( [ PHP_VALGRIND] , [ no] ,,
0 commit comments