From: Michael Wallner Date: Mon, 4 Jan 2016 20:57:03 +0000 (+0100) Subject: workaround for old libffi X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=ad859923be758c210e2ad4226eb8e3b09bcf91eb;p=m6w6%2Fext-psi workaround for old libffi --- diff --git a/m4/psi.m4 b/m4/psi.m4 index 4f09851..eecfa61 100644 --- a/m4/psi.m4 +++ b/m4/psi.m4 @@ -130,6 +130,10 @@ AC_DEFUN(PSI_CHECK_LIBFFI, [ ], [ ], -L$psi_cv_libffi_dir/$PHP_LIBDIR) ], -L$psi_cv_libffi_dir/$PHP_LIBDIR) + PHP_CHECK_LIBRARY(ffi, ffi_prep_cif_var, [ + AC_DEFINE(PSI_HAVE_FFI_PREP_CIF_VAR, 1, [ ]) + ], [ + ], -L$psi_cv_libffi_dir/$PHP_LIBDIR) ]) dnl PSI_COMPUTE_STR(variable, string or expression) diff --git a/src/libffi.c b/src/libffi.c index f776fb7..8d41b7a 100644 --- a/src/libffi.c +++ b/src/libffi.c @@ -283,10 +283,15 @@ static void psi_ffi_call(PSI_Context *C, decl_callinfo *decl_call, impl_vararg * params[nfixedargs + i] = psi_ffi_impl_type(va->types[i]); params[nfixedargs + i + ntotalargs + 1] = &va->values[i]; } - +#ifdef PSI_HAVE_FFI_PREP_CIF_VAR rc = ffi_prep_cif_var(&signature, call->signature.abi, nfixedargs, ntotalargs, call->signature.rtype, (ffi_type **) params); +#else + /* FIXME: test in config.m4; assume we can just call anyway */ + rc = ffi_prep_cif(&signature, call->signature.abi, ntotalargs, + call->signature.rtype, (ffi_type **) params); +#endif ZEND_ASSERT(FFI_OK == rc); ffi_call(&signature, FFI_FN(decl_call->sym), decl_call->rval, ¶ms[ntotalargs + 1]); free(params);