config.m4 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. PHP_ARG_WITH([ffi],
  2. [for FFI support],
  3. [AS_HELP_STRING([--with-ffi],
  4. [Include FFI support])])
  5. if test "$PHP_FFI" != "no"; then
  6. PKG_CHECK_MODULES([FFI], [libffi >= 3.0.11])
  7. PHP_EVAL_INCLINE($FFI_CFLAGS)
  8. PHP_EVAL_LIBLINE($FFI_LIBS, FFI_SHARED_LIBADD)
  9. AC_DEFINE(HAVE_FFI, 1, [Have ffi support])
  10. AC_CHECK_TYPES(long double)
  11. AC_CACHE_CHECK([for fastcall calling convention], ac_cv_ffi_fastcall,
  12. [
  13. AC_COMPILE_IFELSE(
  14. [AC_LANG_PROGRAM([[#include <ffi.h>]],
  15. [[return FFI_FASTCALL]])
  16. ],
  17. [ac_cv_ffi_fastcall=yes], [ac_cv_ffi_fastcall=no])
  18. ])
  19. if test "$ac_cv_ffi_fastcall" = yes; then
  20. AC_DEFINE(HAVE_FFI_FASTCALL,1,[Whether libffi supports fastcall calling convention])
  21. fi
  22. AC_CACHE_CHECK([for thiscall calling convention], ac_cv_ffi_thiscall,
  23. [
  24. AC_COMPILE_IFELSE(
  25. [AC_LANG_PROGRAM([[#include <ffi.h>]],
  26. [[return FFI_THISCALL]])
  27. ],
  28. [ac_cv_ffi_thiscall=yes], [ac_cv_ffi_thiscall=no])
  29. ])
  30. if test "$ac_cv_ffi_thiscall" = yes; then
  31. AC_DEFINE(HAVE_FFI_THISCALL,1,[Whether libffi supports thiscall calling convention])
  32. fi
  33. AC_CACHE_CHECK([for stdcall calling convention], ac_cv_ffi_stdcall,
  34. [
  35. AC_COMPILE_IFELSE(
  36. [AC_LANG_PROGRAM([[#include <ffi.h>]],
  37. [[return FFI_STDCALL]])
  38. ],
  39. [ac_cv_ffi_stdcall=yes], [ac_cv_ffi_stdcall=no])
  40. ])
  41. if test "$ac_cv_ffi_stdcall" = yes; then
  42. AC_DEFINE(HAVE_FFI_STDCALL,1,[Whether libffi supports stdcall calling convention])
  43. fi
  44. AC_CACHE_CHECK([for pascal calling convention], ac_cv_ffi_pascal,
  45. [
  46. AC_COMPILE_IFELSE(
  47. [AC_LANG_PROGRAM([[#include <ffi.h>]],
  48. [[return FFI_PASCAL]])
  49. ],
  50. [ac_cv_ffi_pascal=yes], [ac_cv_ffi_pascal=no])
  51. ])
  52. if test "$ac_cv_ffi_pascal" = yes; then
  53. AC_DEFINE(HAVE_FFI_PASCAL,1,[Whether libffi supports pascal calling convention])
  54. fi
  55. AC_CACHE_CHECK([for register calling convention], ac_cv_ffi_register,
  56. [
  57. AC_COMPILE_IFELSE(
  58. [AC_LANG_PROGRAM([[#include <ffi.h>]],
  59. [[return FFI_REGISTER]])
  60. ],
  61. [ac_cv_ffi_register=yes], [ac_cv_ffi_register=no])
  62. ])
  63. if test "$ac_cv_ffi_register" = yes; then
  64. AC_DEFINE(HAVE_FFI_REGISTER,1,[Whether libffi supports register calling convention])
  65. fi
  66. AC_CACHE_CHECK([for ms_cdecl calling convention], ac_cv_ffi_ms_cdecl,
  67. [
  68. AC_COMPILE_IFELSE(
  69. [AC_LANG_PROGRAM([[#include <ffi.h>]],
  70. [[return FFI_MS_CDECL]])
  71. ],
  72. [ac_cv_ffi_ms_cdecl=yes], [ac_cv_ffi_ms_cdecl=no])
  73. ])
  74. if test "$ac_cv_ffi_ms_cdecl" = yes; then
  75. AC_DEFINE(HAVE_FFI_MS_CDECL,1,[Whether libffi supports ms_cdecl calling convention])
  76. fi
  77. AC_CACHE_CHECK([for sysv calling convention], ac_cv_ffi_sysv,
  78. [
  79. AC_COMPILE_IFELSE(
  80. [AC_LANG_PROGRAM([[#include <ffi.h>]],
  81. [[return FFI_SYSV]])
  82. ],
  83. [ac_cv_ffi_sysv=yes], [ac_cv_ffi_sysv=no])
  84. ])
  85. if test "$ac_cv_ffi_sysv" = yes; then
  86. AC_DEFINE(HAVE_FFI_SYSV,1,[Whether libffi supports sysv calling convention])
  87. fi
  88. PHP_NEW_EXTENSION(ffi, ffi.c ffi_parser.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
  89. PHP_SUBST(FFI_SHARED_LIBADD)
  90. fi