summaryrefslogtreecommitdiff
path: root/dev-lang/php/files/php-capstone-optional.patch
blob: a4719bbb6857d914523b6bcb6d37de2355071f41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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