You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-lang/php/files/php-capstone-optional.patch

79 lines
2.4 KiB

diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
index 444ded9976ac..fb3324cf82a3 100644
--- a/ext/opcache/config.m4
+++ b/ext/opcache/config.m4
@@ -18,6 +18,12 @@ PHP_ARG_ENABLE([opcache-jit],
[yes],
[no])
+PHP_ARG_WITH([opcache-capstone],,
+ [AS_HELP_STRING([--with-opcache-capstone],
+ [support opcache JIT disassembly through capstone])],
+ [no],
+ [no])
+
if test "$PHP_OPCACHE" != "no"; then
dnl Always build as shared extension
@@ -68,41 +74,18 @@ if test "$PHP_OPCACHE" != "no"; then
DASM_FLAGS="$DASM_FLAGS -D ZTS=1"
fi
- PKG_CHECK_MODULES([CAPSTONE], [capstone >= 3.0.0],
- [have_capstone="yes"], [have_capstone="no"])
- if test "$have_capstone" = "yes"; then
- AC_DEFINE(HAVE_CAPSTONE, 1, [ ])
+ AS_IF([test x"$with_opcache_capstone" = "xyes"],[
+ PKG_CHECK_MODULES([CAPSTONE],[capstone >= 3.0.0],[
+ AC_DEFINE([HAVE_CAPSTONE], [1], [Capstone is available])
PHP_EVAL_LIBLINE($CAPSTONE_LIBS, OPCACHE_SHARED_LIBADD)
PHP_EVAL_INCLINE($CAPSTONE_CFLAGS)
- fi
-
- PHP_SUBST(DASM_FLAGS)
- PHP_SUBST(DASM_ARCH)
-
- AC_MSG_CHECKING(for opagent in default path)
- for i in /usr/local /usr; do
- if test -r $i/include/opagent.h; then
- OPAGENT_DIR=$i
- AC_MSG_RESULT(found in $i)
- break
- fi
- done
- if test -z "$OPAGENT_DIR"; then
- AC_MSG_RESULT(not found)
- else
- PHP_CHECK_LIBRARY(opagent, op_write_native_code,
- [
- AC_DEFINE(HAVE_OPROFILE,1,[ ])
- PHP_ADD_INCLUDE($OPAGENT_DIR/include)
- PHP_ADD_LIBRARY_WITH_PATH(opagent, $OPAGENT_DIR/$PHP_LIBDIR/oprofile, OPCACHE_SHARED_LIBADD)
- PHP_SUBST(OPCACHE_SHARED_LIBADD)
- ],[
- AC_MSG_RESULT(not found)
],[
- -L$OPAGENT_DIR/$PHP_LIBDIR/oprofile
+ AC_MSG_ERROR([capstone >= 3.0 required but not found])
])
- fi
+ ])
+ PHP_SUBST(DASM_FLAGS)
+ PHP_SUBST(DASM_ARCH)
fi
AC_CHECK_FUNCS([mprotect memfd_create])
diff --git a/ext/opcache/jit/Makefile.frag b/ext/opcache/jit/Makefile.frag
index 98c5cdaea249..f9ae2e0cf4b9 100644
--- a/ext/opcache/jit/Makefile.frag
+++ b/ext/opcache/jit/Makefile.frag
@@ -11,7 +11,6 @@ $(builddir)/jit/zend_jit.lo: \
$(srcdir)/jit/zend_jit_disasm.c \
$(srcdir)/jit/zend_jit_gdb.c \
$(srcdir)/jit/zend_jit_perf_dump.c \
- $(srcdir)/jit/zend_jit_oprofile.c \
$(srcdir)/jit/zend_jit_vtune.c \
$(srcdir)/jit/zend_jit_trace.c \
$(srcdir)/jit/zend_elf.c