From da69755ecaaa807c64a4df974120fc65077f6231 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Wed, 24 Jul 2024 19:55:01 +0200 Subject: [PATCH] Autotools: Sync CS in opcache Capstone check (#15084) - Added Capstone check message in configure log - PKG_CHECK_MODULES already errors out by default if Capstone is not found with a bit more informative message - Autoconf syntax used - HAVE_CAPSTONE help text synced and updated --- ext/opcache/config.m4 | 16 +++++++--------- ext/opcache/config.w32 | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 index 6f2566f2eab..e25e706a296 100644 --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -18,9 +18,10 @@ PHP_ARG_ENABLE([opcache-jit], [yes], [no]) -PHP_ARG_WITH([capstone],, +PHP_ARG_WITH([capstone], + [whether to support opcache JIT dissasembly through Capstone], [AS_HELP_STRING([--with-capstone], - [support opcache JIT disassembly through capstone])], + [Support opcache JIT disassembly through Capstone])], [no], [no]) @@ -94,16 +95,13 @@ if test "$PHP_OPCACHE" != "no"; then ;; esac - AS_IF([test x"$with_capstone" = "xyes"],[ - PKG_CHECK_MODULES([CAPSTONE],[capstone >= 3.0.0],[ - AC_DEFINE([HAVE_CAPSTONE], [1], [Capstone is available]) + AS_VAR_IF([PHP_CAPSTONE], [yes], + [PKG_CHECK_MODULES([CAPSTONE], [capstone >= 3.0.0], [ + AC_DEFINE([HAVE_CAPSTONE], [1], [Define to 1 if Capstone is available.]) PHP_EVAL_LIBLINE([$CAPSTONE_LIBS], [OPCACHE_SHARED_LIBADD]) PHP_EVAL_INCLINE([$CAPSTONE_CFLAGS]) ZEND_JIT_SRC="$ZEND_JIT_SRC jit/ir/ir_disasm.c" - ],[ - AC_MSG_ERROR([capstone >= 3.0 required but not found]) - ]) - ]) + ])]) PHP_SUBST([IR_TARGET]) PHP_SUBST([DASM_FLAGS]) diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32 index bacb84a3f7c..9c15e52f6f3 100644 --- a/ext/opcache/config.w32 +++ b/ext/opcache/config.w32 @@ -41,7 +41,7 @@ if (PHP_OPCACHE != "no") { if (CHECK_HEADER_ADD_INCLUDE("capstone\\capstone.h", "CFLAGS_OPCACHE", PHP_OPCACHE+ ";" + PHP_PHP_BUILD + "\\include") && CHECK_LIB("capstone.lib", "opcache", PHP_OPCACHE)) { - AC_DEFINE('HAVE_CAPSTONE', 1, 'capstone support enabled'); + AC_DEFINE('HAVE_CAPSTONE', 1, 'Define to 1 if Capstone is available.'); ir_src += " ir_disasm.c"; }