php-src/ext/ffi/config.m4
Peter Kokot b5e2f3a4b6
Check FFI_* ABI with Autoconf AC_CHECK_DECL (#13552)
The FFI_* calling conventions are enum constants and AC_CHECK_DECL(S)
can be used to check for their existence in the ffi.h header. This
simplifes the checks and adds a simple AC_CHECK_DECL macro wrapper which
defines the HAVE_FFI_* belonging symbols.
2024-03-01 19:31:55 +01:00

33 lines
924 B
Plaintext

PHP_ARG_WITH([ffi],
[for FFI support],
[AS_HELP_STRING([--with-ffi],
[Include FFI support])])
if test "$PHP_FFI" != "no"; then
PKG_CHECK_MODULES([FFI], [libffi >= 3.0.11])
PHP_EVAL_INCLINE($FFI_CFLAGS)
PHP_EVAL_LIBLINE($FFI_LIBS, FFI_SHARED_LIBADD)
AC_DEFINE(HAVE_FFI, 1, [Have ffi support])
AC_CHECK_TYPES(long double)
AC_DEFUN([PHP_FFI_CHECK_DECL],
[AC_CHECK_DECL([$1],
[AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1],
[Whether libffi supports the '$1' calling convention.])],,
[#include <ffi.h>])])
PHP_FFI_CHECK_DECL([FFI_FASTCALL])
PHP_FFI_CHECK_DECL([FFI_THISCALL])
PHP_FFI_CHECK_DECL([FFI_STDCALL])
PHP_FFI_CHECK_DECL([FFI_PASCAL])
PHP_FFI_CHECK_DECL([FFI_REGISTER])
PHP_FFI_CHECK_DECL([FFI_MS_CDECL])
PHP_FFI_CHECK_DECL([FFI_SYSV])
PHP_NEW_EXTENSION(ffi, ffi.c ffi_parser.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_SUBST(FFI_SHARED_LIBADD)
fi