You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.2 KiB

  1. From dd6ee0fb6715881b204fb4cb124db9134c1a6c7d Mon Sep 17 00:00:00 2001
  2. From: Michael Heimpold <mhei@heimpold.de>
  3. Date: Mon, 2 Dec 2019 22:42:28 +0100
  4. Subject: [PATCH] ext/opcache: fix detection of shm/mmap
  5. The detection of sysvipc and mmap doesn't work well when cross-compiling,
  6. so I decided to only check for the availability of the functions involved.
  7. This is not a clean solution, but works for now(tm) :-)
  8. It should be discussed with upstream to find a better solution.
  9. This solves the issue reported at
  10. https://github.com/openwrt/packages/issues/1010
  11. and makes opcache usable on OpenWrt.
  12. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
  13. ---
  14. ext/opcache/config.m4 | 10 ++++++++--
  15. 1 file changed, 8 insertions(+), 2 deletions(-)
  16. --- a/ext/opcache/config.m4
  17. +++ b/ext/opcache/config.m4
  18. @@ -167,7 +167,10 @@ int main() {
  19. }
  20. ]])],[dnl
  21. AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support])
  22. - have_shm_ipc=yes],[have_shm_ipc=no],[have_shm_ipc=no])
  23. + have_shm_ipc=yes],[have_shm_ipc=no],[dnl
  24. + AC_CHECK_FUNC(shmget,[dnl
  25. + AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support])
  26. + have_shm_ipc=yes],[have_shm_ipc=no])])
  27. AC_MSG_RESULT([$have_shm_ipc])
  28. AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support)
  29. @@ -219,7 +222,10 @@ int main() {
  30. }
  31. ]])],[dnl
  32. AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support])
  33. - have_shm_mmap_anon=yes],[have_shm_mmap_anon=no],[have_shm_mmap_anon=no])
  34. + have_shm_mmap_anon=yes],[have_shm_mmap_anon=no],[dnl
  35. + AC_CHECK_FUNC(mmap,[dnl
  36. + AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support])
  37. + have_shm_mmap_anon=yes],[have_shm_mmap_anon=no])])
  38. AC_MSG_RESULT([$have_shm_mmap_anon])
  39. PHP_CHECK_FUNC_LIB(shm_open, rt, root)
  40. @@ -294,8 +300,11 @@ int main() {
  41. PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
  42. ],[
  43. AC_MSG_RESULT([no])
  44. - ],[
  45. - AC_MSG_RESULT([no])
  46. + ],[dnl
  47. + AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])
  48. + AC_MSG_RESULT([yes])
  49. + have_shm_mmap_posix=yes
  50. + PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
  51. ])
  52. PHP_NEW_EXTENSION(opcache,