From dd6ee0fb6715881b204fb4cb124db9134c1a6c7d Mon Sep 17 00:00:00 2001 From: Michael Heimpold Date: Mon, 2 Dec 2019 22:42:28 +0100 Subject: [PATCH] ext/opcache: fix detection of shm/mmap The detection of sysvipc and mmap doesn't work well when cross-compiling, so I decided to only check for the availability of the functions involved. This is not a clean solution, but works for now(tm) :-) It should be discussed with upstream to find a better solution. This solves the issue reported at https://github.com/openwrt/packages/issues/1010 and makes opcache usable on OpenWrt. Signed-off-by: Michael Heimpold --- ext/opcache/config.m4 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/ext/opcache/config.m4 +++ b/ext/opcache/config.m4 @@ -167,7 +167,10 @@ int main() { } ]])],[dnl AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) - have_shm_ipc=yes],[have_shm_ipc=no],[have_shm_ipc=no]) + have_shm_ipc=yes],[have_shm_ipc=no],[dnl + AC_CHECK_FUNC(shmget,[dnl + AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) + have_shm_ipc=yes],[have_shm_ipc=no])]) AC_MSG_RESULT([$have_shm_ipc]) AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support) @@ -219,7 +222,10 @@ int main() { } ]])],[dnl AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) - have_shm_mmap_anon=yes],[have_shm_mmap_anon=no],[have_shm_mmap_anon=no]) + have_shm_mmap_anon=yes],[have_shm_mmap_anon=no],[dnl + AC_CHECK_FUNC(mmap,[dnl + AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) + have_shm_mmap_anon=yes],[have_shm_mmap_anon=no])]) AC_MSG_RESULT([$have_shm_mmap_anon=yes]) PHP_CHECK_FUNC_LIB(shm_open, rt, root) @@ -294,8 +300,11 @@ int main() { PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) ],[ AC_MSG_RESULT([no]) - ],[ - AC_MSG_RESULT([no]) + ],[dnl + AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) + AC_MSG_RESULT([yes]) + have_shm_mmap_posix=yes + PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) ]) PHP_NEW_EXTENSION(opcache,