xref: /PHP-8.4/ext/ffi/config.m4 (revision f66feaec)
1PHP_ARG_WITH([ffi],
2  [for FFI support],
3  [AS_HELP_STRING([--with-ffi],
4    [Include FFI support])])
5
6if test "$PHP_FFI" != "no"; then
7  PKG_CHECK_MODULES([FFI], [libffi >= 3.0.11])
8
9  PHP_EVAL_INCLINE([$FFI_CFLAGS])
10  PHP_EVAL_LIBLINE([$FFI_LIBS], [FFI_SHARED_LIBADD])
11
12  AC_DEFINE([HAVE_FFI], [1],
13    [Define to 1 if the PHP extension 'ffi' is available.])
14
15  AC_CHECK_TYPES([long double])
16
17  AC_DEFUN([PHP_FFI_CHECK_DECL],
18    [AC_CHECK_DECL([$1],
19      [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1]), [1],
20        [Define to 1 if libffi supports the '$1' calling convention.])],,
21      [#include <ffi.h>])])
22
23  CFLAGS_SAVE=$CFLAGS
24  CFLAGS="$CFLAGS $FFI_CFLAGS"
25  PHP_FFI_CHECK_DECL([FFI_FASTCALL])
26  PHP_FFI_CHECK_DECL([FFI_THISCALL])
27  PHP_FFI_CHECK_DECL([FFI_STDCALL])
28  PHP_FFI_CHECK_DECL([FFI_PASCAL])
29  PHP_FFI_CHECK_DECL([FFI_REGISTER])
30  PHP_FFI_CHECK_DECL([FFI_MS_CDECL])
31  PHP_FFI_CHECK_DECL([FFI_SYSV])
32  CFLAGS=$CFLAGS_SAVE
33
34  PHP_NEW_EXTENSION([ffi],
35    [ffi.c ffi_parser.c],
36    [$ext_shared],,
37    [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
38  PHP_SUBST([FFI_SHARED_LIBADD])
39fi
40