11ARG_WITH('ffi', 'ffi support', 'no');
22
33if (PHP_FFI != 'no') {
4- if (CHECK_HEADER_ADD_INCLUDE("ffi.h", "CFLAGS_FFI", PHP_FFI+ ";" + PHP_PHP_BUILD + "\\include") &&
5- CHECK_LIB("libffi.lib", "ffi", PHP_FFI)) {
4+ if (PKG_CHECK_MODULES("LIBFFI", "libffi")) {
5+ PHP_EVAL_INCLINE(LIBFFI_CFLAGS, "ffi");
6+ PHP_EVAL_LIBLINE(LIBFFI_LIBS, "ffi");
67 AC_DEFINE('HAVE_FFI', 1, "Define to 1 if the PHP extension 'ffi' is available.");
78
89 if (!X64) {
@@ -13,12 +14,11 @@ if (PHP_FFI != 'no') {
1314 AC_DEFINE('HAVE_FFI_SYSV', 1, 'Define to 1 if libffi supports the sysv calling convention.');
1415 }
1516 // Available in https://github.com/winlibs/libffi.
16- if (GREP_HEADER("ffitarget.h", "FFI_VECTORCALL_PARTIAL", PHP_PHP_BUILD + "\\include")) {
17- AC_DEFINE('HAVE_FFI_VECTORCALL_PARTIAL', 1, 'Define to 1 if libffi partially supports the vectorcall calling convention.');
18- }
17+ // FIXME: only define if actually supported
18+ AC_DEFINE('HAVE_FFI_VECTORCALL_PARTIAL', 1, 'Define to 1 if libffi partially supports the vectorcall calling convention.');
1919
2020 EXTENSION('ffi', 'ffi.c ffi_parser.c', null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
2121 } else {
22- WARNING('ffi not enabled, headers or libraries not found');
22+ WARNING('ffi not enabled; libffi package not found');
2323 }
2424}
0 commit comments