Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | opcache/config.m4: enable opcache |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 2 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 3 | We can't use AC_TRY_RUN to run programs in a cross compile environment. |
| 4 | Set |
| 5 | the variables directly instead since we know that we'd be running on |
| 6 | latest |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 7 | enough linux kernel. |
| 8 | |
| 9 | Upstream-Status: Inappropriate [Configuration] |
| 10 | |
| 11 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 12 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 13 | update patch to version 7.4.4 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 14 | Signed-off-by: Changqing Li <changqing.li@windriver.com> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 15 | --- |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 16 | ext/opcache/config.m4 | 194 +------------------------------------------------- |
| 17 | 1 file changed, 3 insertions(+), 191 deletions(-) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 18 | |
| 19 | diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 20 | index 6c40caf..84ddf1e 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 21 | --- a/ext/opcache/config.m4 |
| 22 | +++ b/ext/opcache/config.m4 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 23 | @@ -23,201 +23,13 @@ if test "$PHP_OPCACHE" != "no"; then |
| 24 | AC_CHECK_FUNCS([mprotect]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 25 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 26 | AC_MSG_CHECKING(for sysvipc shared memory support) |
| 27 | - AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 28 | -#include <sys/types.h> |
| 29 | -#include <sys/wait.h> |
| 30 | -#include <sys/ipc.h> |
| 31 | -#include <sys/shm.h> |
| 32 | -#include <unistd.h> |
| 33 | -#include <string.h> |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 34 | - |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 35 | -int main() { |
| 36 | - pid_t pid; |
| 37 | - int status; |
| 38 | - int ipc_id; |
| 39 | - char *shm; |
| 40 | - struct shmid_ds shmbuf; |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 41 | - |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 42 | - ipc_id = shmget(IPC_PRIVATE, 4096, (IPC_CREAT | SHM_R | SHM_W)); |
| 43 | - if (ipc_id == -1) { |
| 44 | - return 1; |
| 45 | - } |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 46 | - |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 47 | - shm = shmat(ipc_id, NULL, 0); |
| 48 | - if (shm == (void *)-1) { |
| 49 | - shmctl(ipc_id, IPC_RMID, NULL); |
| 50 | - return 2; |
| 51 | - } |
| 52 | - |
| 53 | - if (shmctl(ipc_id, IPC_STAT, &shmbuf) != 0) { |
| 54 | - shmdt(shm); |
| 55 | - shmctl(ipc_id, IPC_RMID, NULL); |
| 56 | - return 3; |
| 57 | - } |
| 58 | - |
| 59 | - shmbuf.shm_perm.uid = getuid(); |
| 60 | - shmbuf.shm_perm.gid = getgid(); |
| 61 | - shmbuf.shm_perm.mode = 0600; |
| 62 | - |
| 63 | - if (shmctl(ipc_id, IPC_SET, &shmbuf) != 0) { |
| 64 | - shmdt(shm); |
| 65 | - shmctl(ipc_id, IPC_RMID, NULL); |
| 66 | - return 4; |
| 67 | - } |
| 68 | - |
| 69 | - shmctl(ipc_id, IPC_RMID, NULL); |
| 70 | - |
| 71 | - strcpy(shm, "hello"); |
| 72 | - |
| 73 | - pid = fork(); |
| 74 | - if (pid < 0) { |
| 75 | - return 5; |
| 76 | - } else if (pid == 0) { |
| 77 | - strcpy(shm, "bye"); |
| 78 | - return 6; |
| 79 | - } |
| 80 | - if (wait(&status) != pid) { |
| 81 | - return 7; |
| 82 | - } |
| 83 | - if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { |
| 84 | - return 8; |
| 85 | - } |
| 86 | - if (strcmp(shm, "bye") != 0) { |
| 87 | - return 9; |
| 88 | - } |
| 89 | - return 0; |
| 90 | -} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 91 | -]])],[dnl |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 92 | - AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 93 | - msg=yes],[msg=no],[msg=no]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 94 | - AC_MSG_RESULT([$msg]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 95 | + AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 96 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 97 | AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support) |
| 98 | - AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 99 | -#include <sys/types.h> |
| 100 | -#include <sys/wait.h> |
| 101 | -#include <sys/mman.h> |
| 102 | -#include <unistd.h> |
| 103 | -#include <string.h> |
| 104 | - |
| 105 | -#ifndef MAP_ANON |
| 106 | -# ifdef MAP_ANONYMOUS |
| 107 | -# define MAP_ANON MAP_ANONYMOUS |
| 108 | -# endif |
| 109 | -#endif |
| 110 | -#ifndef MAP_FAILED |
| 111 | -# define MAP_FAILED ((void*)-1) |
| 112 | -#endif |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 113 | + AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) |
| 114 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 115 | -int main() { |
| 116 | - pid_t pid; |
| 117 | - int status; |
| 118 | - char *shm; |
| 119 | - |
| 120 | - shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); |
| 121 | - if (shm == MAP_FAILED) { |
| 122 | - return 1; |
| 123 | - } |
| 124 | - |
| 125 | - strcpy(shm, "hello"); |
| 126 | - |
| 127 | - pid = fork(); |
| 128 | - if (pid < 0) { |
| 129 | - return 5; |
| 130 | - } else if (pid == 0) { |
| 131 | - strcpy(shm, "bye"); |
| 132 | - return 6; |
| 133 | - } |
| 134 | - if (wait(&status) != pid) { |
| 135 | - return 7; |
| 136 | - } |
| 137 | - if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { |
| 138 | - return 8; |
| 139 | - } |
| 140 | - if (strcmp(shm, "bye") != 0) { |
| 141 | - return 9; |
| 142 | - } |
| 143 | - return 0; |
| 144 | -} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 145 | -]])],[dnl |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 146 | - AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 147 | - msg=yes],[msg=no],[msg=no]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 148 | - AC_MSG_RESULT([$msg]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 149 | - |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 150 | - PHP_CHECK_FUNC_LIB(shm_open, rt) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 151 | AC_MSG_CHECKING(for mmap() using shm_open() shared memory support) |
| 152 | - AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 153 | -#include <sys/types.h> |
| 154 | -#include <sys/wait.h> |
| 155 | -#include <sys/mman.h> |
| 156 | -#include <sys/stat.h> |
| 157 | -#include <fcntl.h> |
| 158 | -#include <unistd.h> |
| 159 | -#include <string.h> |
| 160 | -#include <stdlib.h> |
| 161 | -#include <stdio.h> |
| 162 | - |
| 163 | -#ifndef MAP_FAILED |
| 164 | -# define MAP_FAILED ((void*)-1) |
| 165 | -#endif |
| 166 | - |
| 167 | -int main() { |
| 168 | - pid_t pid; |
| 169 | - int status; |
| 170 | - int fd; |
| 171 | - char *shm; |
| 172 | - char tmpname[4096]; |
| 173 | - |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 174 | - sprintf(tmpname,"/opcache.test.shm.%dXXXXXX", getpid()); |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 175 | - if (mktemp(tmpname) == NULL) { |
| 176 | - return 1; |
| 177 | - } |
| 178 | - fd = shm_open(tmpname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); |
| 179 | - if (fd == -1) { |
| 180 | - return 2; |
| 181 | - } |
| 182 | - if (ftruncate(fd, 4096) < 0) { |
| 183 | - close(fd); |
| 184 | - shm_unlink(tmpname); |
| 185 | - return 3; |
| 186 | - } |
| 187 | - |
| 188 | - shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); |
| 189 | - if (shm == MAP_FAILED) { |
| 190 | - return 4; |
| 191 | - } |
| 192 | - shm_unlink(tmpname); |
| 193 | - close(fd); |
| 194 | - |
| 195 | - strcpy(shm, "hello"); |
| 196 | - |
| 197 | - pid = fork(); |
| 198 | - if (pid < 0) { |
| 199 | - return 5; |
| 200 | - } else if (pid == 0) { |
| 201 | - strcpy(shm, "bye"); |
| 202 | - return 6; |
| 203 | - } |
| 204 | - if (wait(&status) != pid) { |
| 205 | - return 7; |
| 206 | - } |
| 207 | - if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { |
| 208 | - return 8; |
| 209 | - } |
| 210 | - if (strcmp(shm, "bye") != 0) { |
| 211 | - return 9; |
| 212 | - } |
| 213 | - return 0; |
| 214 | -} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 215 | -]])],[dnl |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 216 | - AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 217 | - AC_MSG_RESULT([yes]) |
| 218 | - PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) |
| 219 | - ],[ |
| 220 | - AC_MSG_RESULT([no]) |
| 221 | - ],[ |
| 222 | - AC_MSG_RESULT([no]) |
| 223 | - ]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 224 | + AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) |
| 225 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 226 | PHP_NEW_EXTENSION(opcache, |
| 227 | ZendAccelerator.c \ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 228 | -- |
| 229 | 2.7.4 |
| 230 | |