Skip to content

Autotools: Sync CS in opcache Capstone check #15084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions ext/opcache/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down Expand Up @@ -81,16 +82,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])
])
])
Comment on lines -90 to -93
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason to remove this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default PKG_CHECK_MODULES error message is thrown if the 4th argument is empty:

checking whether to enable JIT... yes
checking whether to support opcache JIT dissasembly through Capstone... yes
checking for capstone >= 3.0.0... no
configure: error: Package requirements (capstone >= 3.0.0) were not met:

Package 'capstone' not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables CAPSTONE_CFLAGS
and CAPSTONE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

otherwise if the 4th argument is added, the error message is like this:

checking whether to enable JIT... yes
checking for capstone >= 3.0.0... no
configure: error: capstone >= 3.0 required but not found

])])

PHP_SUBST([IR_TARGET])
PHP_SUBST([DASM_FLAGS])
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
Loading