mirror of
https://github.com/php/php-src.git
synced 2024-11-27 11:53:33 +08:00
Merge branch 'PHP-7.4'
* PHP-7.4: Check for supported libffi ABI
This commit is contained in:
commit
6b691cd44e
@ -17,6 +17,97 @@ if test "$PHP_FFI" != "no"; then
|
||||
AC_MSG_ERROR(FFI module requires libffi)
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for fastcall calling convention], ac_cv_ffi_fastcall,
|
||||
[
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <ffi.h>]],
|
||||
[[return FFI_FASTCALL]])
|
||||
],
|
||||
[ac_cv_ffi_fastcall=yes], [ac_cv_ffi_fastcall=no])
|
||||
])
|
||||
|
||||
if test "$ac_cv_ffi_fastcall" = yes; then
|
||||
AC_DEFINE(HAVE_FFI_FASTCALL,1,[Whether libffi supports fastcall calling convention])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for thiscall calling convention], ac_cv_ffi_thiscall,
|
||||
[
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <ffi.h>]],
|
||||
[[return FFI_THISCALL]])
|
||||
],
|
||||
[ac_cv_ffi_thiscall=yes], [ac_cv_ffi_thiscall=no])
|
||||
])
|
||||
|
||||
if test "$ac_cv_ffi_thiscall" = yes; then
|
||||
AC_DEFINE(HAVE_FFI_THISCALL,1,[Whether libffi supports thiscall calling convention])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for stdcall calling convention], ac_cv_ffi_stdcall,
|
||||
[
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <ffi.h>]],
|
||||
[[return FFI_STDCALL]])
|
||||
],
|
||||
[ac_cv_ffi_stdcall=yes], [ac_cv_ffi_stdcall=no])
|
||||
])
|
||||
|
||||
if test "$ac_cv_ffi_stdcall" = yes; then
|
||||
AC_DEFINE(HAVE_FFI_STDCALL,1,[Whether libffi supports stdcall calling convention])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for pascal calling convention], ac_cv_ffi_pascal,
|
||||
[
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <ffi.h>]],
|
||||
[[return FFI_PASCAL]])
|
||||
],
|
||||
[ac_cv_ffi_pascal=yes], [ac_cv_ffi_pascal=no])
|
||||
])
|
||||
|
||||
if test "$ac_cv_ffi_pascal" = yes; then
|
||||
AC_DEFINE(HAVE_FFI_PASCAL,1,[Whether libffi supports pascal calling convention])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for register calling convention], ac_cv_ffi_register,
|
||||
[
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <ffi.h>]],
|
||||
[[return FFI_REGISTER]])
|
||||
],
|
||||
[ac_cv_ffi_register=yes], [ac_cv_ffi_register=no])
|
||||
])
|
||||
|
||||
if test "$ac_cv_ffi_register" = yes; then
|
||||
AC_DEFINE(HAVE_FFI_REGISTER,1,[Whether libffi supports register calling convention])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for ms_cdecl calling convention], ac_cv_ffi_ms_cdecl,
|
||||
[
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <ffi.h>]],
|
||||
[[return FFI_MS_CDECL]])
|
||||
],
|
||||
[ac_cv_ffi_ms_cdecl=yes], [ac_cv_ffi_ms_cdecl=no])
|
||||
])
|
||||
|
||||
if test "$ac_cv_ffi_ms_cdecl" = yes; then
|
||||
AC_DEFINE(HAVE_FFI_MS_CDECL,1,[Whether libffi supports ms_cdecl calling convention])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for sysv calling convention], ac_cv_ffi_sysv,
|
||||
[
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <ffi.h>]],
|
||||
[[return FFI_SYSV]])
|
||||
],
|
||||
[ac_cv_ffi_sysv=yes], [ac_cv_ffi_sysv=no])
|
||||
])
|
||||
|
||||
if test "$ac_cv_ffi_sysv" = yes; then
|
||||
AC_DEFINE(HAVE_FFI_SYSV,1,[Whether libffi supports sysv calling convention])
|
||||
fi
|
||||
|
||||
PHP_NEW_EXTENSION(ffi, ffi.c ffi_parser.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
|
||||
PHP_SUBST(FFI_SHARED_LIBADD)
|
||||
fi
|
||||
|
@ -5,6 +5,14 @@ if (PHP_FFI != 'no') {
|
||||
CHECK_LIB("libffi.lib", "ffi", PHP_FFI)) {
|
||||
AC_DEFINE('HAVE_FFI', 1, 'ffi support enabled');
|
||||
|
||||
if (!X64) {
|
||||
AC_DEFINE('HAVE_FFI_FASTCALL', 1 ,'libffi supports fastcall calling convention');
|
||||
AC_DEFINE('HAVE_FFI_THISCALL', 1 ,'libffi supports thiscall calling convention');
|
||||
AC_DEFINE('HAVE_FFI_STDCALL', 1 ,'libffi supports stdcall calling convention');
|
||||
AC_DEFINE('HAVE_FFI_MS_CDELC', 1 ,'libffi supports ms_cdecl calling convention');
|
||||
AC_DEFINE('HAVE_FFI_SYSV', 1 ,'libffi supports sysv calling convention');
|
||||
}
|
||||
|
||||
EXTENSION('ffi', 'ffi.c ffi_parser.c', null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
|
||||
} else {
|
||||
WARNING('ffi not enabled, headers or libraries not found');
|
||||
|
@ -5643,33 +5643,37 @@ void zend_ffi_make_func_type(zend_ffi_dcl *dcl, HashTable *args) /* {{{ */
|
||||
case ZEND_FFI_ABI_CDECL:
|
||||
type->func.abi = FFI_DEFAULT_ABI;
|
||||
break;
|
||||
#ifndef _WIN64
|
||||
#ifdef HAVE_FFI_FASTCALL
|
||||
case ZEND_FFI_ABI_FASTCALL:
|
||||
type->func.abi = FFI_FASTCALL;
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_FFI_THISCALL
|
||||
case ZEND_FFI_ABI_THISCALL:
|
||||
type->func.abi = FFI_THISCALL;
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_FFI_STDCALL
|
||||
case ZEND_FFI_ABI_STDCALL:
|
||||
type->func.abi = FFI_STDCALL;
|
||||
break;
|
||||
#endif
|
||||
#if 0
|
||||
#ifdef HAVE_FFI_PASCAL
|
||||
case ZEND_FFI_ABI_PASCAL:
|
||||
type->func.abi = FFI_PASCAL;
|
||||
break;
|
||||
#endif
|
||||
#if 0
|
||||
#ifdef HAVE_FFI_REGISTER
|
||||
case ZEND_FFI_ABI_REGISTER:
|
||||
type->func.abi = FFI_REGISTER;
|
||||
break;
|
||||
#endif
|
||||
#ifdef X86_WIN32
|
||||
#ifdef HAVE_FFI_MS_CDELC
|
||||
case ZEND_FFI_ABI_MS:
|
||||
type->func.abi = FFI_MS_CDECL;
|
||||
break;
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
#ifdef HAVE_FFI_SYSV
|
||||
case ZEND_FFI_ABI_SYSV:
|
||||
type->func.abi = FFI_SYSV;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user