Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | From 8de5ba69d20d049b8ca983a9470c7303142ec0b3 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 2 | From: Changqing Li <changqing.li@windriver.com> |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 3 | Date: Sun, 28 Apr 2019 16:55:13 +0800 |
| 4 | Subject: [PATCH] From fb139d9707dabe1684b472a08a6eb5761ede4a3a Mon Sep 17 |
| 5 | 00:00:00 2001 From: Changqing Li <changqing.li@windriver.com> Date: Tue, 12 |
| 6 | Feb 2019 14:56:16 +0800 Subject: [PATCH] opcache/config.m4: enable opcache |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 7 | |
| 8 | We can't use AC_TRY_RUN to run programs in a cross compile environment. Set |
| 9 | the variables directly instead since we know that we'd be running on latest |
| 10 | enough linux kernel. |
| 11 | |
| 12 | Upstream-Status: Inappropriate [Configuration] |
| 13 | |
| 14 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 15 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 16 | update patch to version 7.3.4 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 17 | Signed-off-by: Changqing Li <changqing.li@windriver.com> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 18 | --- |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 19 | ext/opcache/config.m4 | 312 +------------------------------------------------- |
| 20 | 1 file changed, 6 insertions(+), 306 deletions(-) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 21 | |
| 22 | diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 23 | index 4810217..22c3d61 100644 |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 24 | --- a/ext/opcache/config.m4 |
| 25 | +++ b/ext/opcache/config.m4 |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 26 | @@ -27,319 +27,19 @@ if test "$PHP_OPCACHE" != "no"; then |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 27 | AC_CHECK_HEADERS([unistd.h sys/uio.h]) |
| 28 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 29 | AC_MSG_CHECKING(for sysvipc shared memory support) |
| 30 | - AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 31 | -#include <sys/types.h> |
| 32 | -#include <sys/wait.h> |
| 33 | -#include <sys/ipc.h> |
| 34 | -#include <sys/shm.h> |
| 35 | -#include <unistd.h> |
| 36 | -#include <string.h> |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 37 | - |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 38 | -int main() { |
| 39 | - pid_t pid; |
| 40 | - int status; |
| 41 | - int ipc_id; |
| 42 | - char *shm; |
| 43 | - struct shmid_ds shmbuf; |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 44 | - |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 45 | - ipc_id = shmget(IPC_PRIVATE, 4096, (IPC_CREAT | SHM_R | SHM_W)); |
| 46 | - if (ipc_id == -1) { |
| 47 | - return 1; |
| 48 | - } |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 49 | - |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 50 | - shm = shmat(ipc_id, NULL, 0); |
| 51 | - if (shm == (void *)-1) { |
| 52 | - shmctl(ipc_id, IPC_RMID, NULL); |
| 53 | - return 2; |
| 54 | - } |
| 55 | - |
| 56 | - if (shmctl(ipc_id, IPC_STAT, &shmbuf) != 0) { |
| 57 | - shmdt(shm); |
| 58 | - shmctl(ipc_id, IPC_RMID, NULL); |
| 59 | - return 3; |
| 60 | - } |
| 61 | - |
| 62 | - shmbuf.shm_perm.uid = getuid(); |
| 63 | - shmbuf.shm_perm.gid = getgid(); |
| 64 | - shmbuf.shm_perm.mode = 0600; |
| 65 | - |
| 66 | - if (shmctl(ipc_id, IPC_SET, &shmbuf) != 0) { |
| 67 | - shmdt(shm); |
| 68 | - shmctl(ipc_id, IPC_RMID, NULL); |
| 69 | - return 4; |
| 70 | - } |
| 71 | - |
| 72 | - shmctl(ipc_id, IPC_RMID, NULL); |
| 73 | - |
| 74 | - strcpy(shm, "hello"); |
| 75 | - |
| 76 | - pid = fork(); |
| 77 | - if (pid < 0) { |
| 78 | - return 5; |
| 79 | - } else if (pid == 0) { |
| 80 | - strcpy(shm, "bye"); |
| 81 | - return 6; |
| 82 | - } |
| 83 | - if (wait(&status) != pid) { |
| 84 | - return 7; |
| 85 | - } |
| 86 | - if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { |
| 87 | - return 8; |
| 88 | - } |
| 89 | - if (strcmp(shm, "bye") != 0) { |
| 90 | - return 9; |
| 91 | - } |
| 92 | - return 0; |
| 93 | -} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 94 | -]])],[dnl |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 95 | - 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] | 96 | - msg=yes],[msg=no],[msg=no]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 97 | - AC_MSG_RESULT([$msg]) |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 98 | - |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 99 | + AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support]) |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 100 | + |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 101 | AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support) |
| 102 | - AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 103 | -#include <sys/types.h> |
| 104 | -#include <sys/wait.h> |
| 105 | -#include <sys/mman.h> |
| 106 | -#include <unistd.h> |
| 107 | -#include <string.h> |
| 108 | - |
| 109 | -#ifndef MAP_ANON |
| 110 | -# ifdef MAP_ANONYMOUS |
| 111 | -# define MAP_ANON MAP_ANONYMOUS |
| 112 | -# endif |
| 113 | -#endif |
| 114 | -#ifndef MAP_FAILED |
| 115 | -# define MAP_FAILED ((void*)-1) |
| 116 | -#endif |
| 117 | - |
| 118 | -int main() { |
| 119 | - pid_t pid; |
| 120 | - int status; |
| 121 | - char *shm; |
| 122 | - |
| 123 | - shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); |
| 124 | - if (shm == MAP_FAILED) { |
| 125 | - return 1; |
| 126 | - } |
| 127 | - |
| 128 | - strcpy(shm, "hello"); |
| 129 | - |
| 130 | - pid = fork(); |
| 131 | - if (pid < 0) { |
| 132 | - return 5; |
| 133 | - } else if (pid == 0) { |
| 134 | - strcpy(shm, "bye"); |
| 135 | - return 6; |
| 136 | - } |
| 137 | - if (wait(&status) != pid) { |
| 138 | - return 7; |
| 139 | - } |
| 140 | - if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { |
| 141 | - return 8; |
| 142 | - } |
| 143 | - if (strcmp(shm, "bye") != 0) { |
| 144 | - return 9; |
| 145 | - } |
| 146 | - return 0; |
| 147 | -} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 148 | -]])],[dnl |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 149 | - 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] | 150 | - msg=yes],[msg=no],[msg=no]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 151 | - AC_MSG_RESULT([$msg]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 152 | + AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support]) |
| 153 | |
| 154 | AC_MSG_CHECKING(for mmap() using /dev/zero shared memory support) |
| 155 | - AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 156 | -#include <sys/types.h> |
| 157 | -#include <sys/wait.h> |
| 158 | -#include <sys/mman.h> |
| 159 | -#include <sys/stat.h> |
| 160 | -#include <fcntl.h> |
| 161 | -#include <unistd.h> |
| 162 | -#include <string.h> |
| 163 | - |
| 164 | -#ifndef MAP_FAILED |
| 165 | -# define MAP_FAILED ((void*)-1) |
| 166 | -#endif |
| 167 | - |
| 168 | -int main() { |
| 169 | - pid_t pid; |
| 170 | - int status; |
| 171 | - int fd; |
| 172 | - char *shm; |
| 173 | - |
| 174 | - fd = open("/dev/zero", O_RDWR, S_IRUSR | S_IWUSR); |
| 175 | - if (fd == -1) { |
| 176 | - return 1; |
| 177 | - } |
| 178 | - |
| 179 | - shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); |
| 180 | - if (shm == MAP_FAILED) { |
| 181 | - return 2; |
| 182 | - } |
| 183 | - |
| 184 | - strcpy(shm, "hello"); |
| 185 | - |
| 186 | - pid = fork(); |
| 187 | - if (pid < 0) { |
| 188 | - return 5; |
| 189 | - } else if (pid == 0) { |
| 190 | - strcpy(shm, "bye"); |
| 191 | - return 6; |
| 192 | - } |
| 193 | - if (wait(&status) != pid) { |
| 194 | - return 7; |
| 195 | - } |
| 196 | - if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { |
| 197 | - return 8; |
| 198 | - } |
| 199 | - if (strcmp(shm, "bye") != 0) { |
| 200 | - return 9; |
| 201 | - } |
| 202 | - return 0; |
| 203 | -} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 204 | -]])],[dnl |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 205 | - AC_DEFINE(HAVE_SHM_MMAP_ZERO, 1, [Define if you have mmap("/dev/zero") SHM support]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 206 | - msg=yes],[msg=no],[msg=no]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 207 | - AC_MSG_RESULT([$msg]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 208 | + AC_DEFINE(HAVE_SHM_MMAP_ZERO, 1, [Define if you have mmap("/dev/zero") SHM support]) |
| 209 | |
| 210 | AC_MSG_CHECKING(for mmap() using shm_open() shared memory support) |
| 211 | - AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 212 | -#include <sys/types.h> |
| 213 | -#include <sys/wait.h> |
| 214 | -#include <sys/mman.h> |
| 215 | -#include <sys/stat.h> |
| 216 | -#include <fcntl.h> |
| 217 | -#include <unistd.h> |
| 218 | -#include <string.h> |
| 219 | -#include <stdlib.h> |
| 220 | -#include <stdio.h> |
| 221 | - |
| 222 | -#ifndef MAP_FAILED |
| 223 | -# define MAP_FAILED ((void*)-1) |
| 224 | -#endif |
| 225 | - |
| 226 | -int main() { |
| 227 | - pid_t pid; |
| 228 | - int status; |
| 229 | - int fd; |
| 230 | - char *shm; |
| 231 | - char tmpname[4096]; |
| 232 | - |
| 233 | - sprintf(tmpname,"test.shm.%dXXXXXX", getpid()); |
| 234 | - if (mktemp(tmpname) == NULL) { |
| 235 | - return 1; |
| 236 | - } |
| 237 | - fd = shm_open(tmpname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); |
| 238 | - if (fd == -1) { |
| 239 | - return 2; |
| 240 | - } |
| 241 | - if (ftruncate(fd, 4096) < 0) { |
| 242 | - close(fd); |
| 243 | - shm_unlink(tmpname); |
| 244 | - return 3; |
| 245 | - } |
| 246 | - |
| 247 | - shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); |
| 248 | - if (shm == MAP_FAILED) { |
| 249 | - return 4; |
| 250 | - } |
| 251 | - shm_unlink(tmpname); |
| 252 | - close(fd); |
| 253 | - |
| 254 | - strcpy(shm, "hello"); |
| 255 | - |
| 256 | - pid = fork(); |
| 257 | - if (pid < 0) { |
| 258 | - return 5; |
| 259 | - } else if (pid == 0) { |
| 260 | - strcpy(shm, "bye"); |
| 261 | - return 6; |
| 262 | - } |
| 263 | - if (wait(&status) != pid) { |
| 264 | - return 7; |
| 265 | - } |
| 266 | - if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { |
| 267 | - return 8; |
| 268 | - } |
| 269 | - if (strcmp(shm, "bye") != 0) { |
| 270 | - return 9; |
| 271 | - } |
| 272 | - return 0; |
| 273 | -} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 274 | -]])],[dnl |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 275 | - AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 276 | - msg=yes],[msg=no],[msg=no]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 277 | - AC_MSG_RESULT([$msg]) |
| 278 | + AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) |
| 279 | |
| 280 | AC_MSG_CHECKING(for mmap() using regular file shared memory support) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 281 | - AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 282 | -#include <sys/types.h> |
| 283 | -#include <sys/wait.h> |
| 284 | -#include <sys/mman.h> |
| 285 | -#include <sys/stat.h> |
| 286 | -#include <fcntl.h> |
| 287 | -#include <unistd.h> |
| 288 | -#include <string.h> |
| 289 | -#include <stdlib.h> |
| 290 | -#include <stdio.h> |
| 291 | - |
| 292 | -#ifndef MAP_FAILED |
| 293 | -# define MAP_FAILED ((void*)-1) |
| 294 | -#endif |
| 295 | - |
| 296 | -int main() { |
| 297 | - pid_t pid; |
| 298 | - int status; |
| 299 | - int fd; |
| 300 | - char *shm; |
| 301 | - char tmpname[4096]; |
| 302 | - |
| 303 | - sprintf(tmpname,"test.shm.%dXXXXXX", getpid()); |
| 304 | - if (mktemp(tmpname) == NULL) { |
| 305 | - return 1; |
| 306 | - } |
| 307 | - fd = open(tmpname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); |
| 308 | - if (fd == -1) { |
| 309 | - return 2; |
| 310 | - } |
| 311 | - if (ftruncate(fd, 4096) < 0) { |
| 312 | - close(fd); |
| 313 | - unlink(tmpname); |
| 314 | - return 3; |
| 315 | - } |
| 316 | - |
| 317 | - shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); |
| 318 | - if (shm == MAP_FAILED) { |
| 319 | - return 4; |
| 320 | - } |
| 321 | - unlink(tmpname); |
| 322 | - close(fd); |
| 323 | - |
| 324 | - strcpy(shm, "hello"); |
| 325 | - |
| 326 | - pid = fork(); |
| 327 | - if (pid < 0) { |
| 328 | - return 5; |
| 329 | - } else if (pid == 0) { |
| 330 | - strcpy(shm, "bye"); |
| 331 | - return 6; |
| 332 | - } |
| 333 | - if (wait(&status) != pid) { |
| 334 | - return 7; |
| 335 | - } |
| 336 | - if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) { |
| 337 | - return 8; |
| 338 | - } |
| 339 | - if (strcmp(shm, "bye") != 0) { |
| 340 | - return 9; |
| 341 | - } |
| 342 | - return 0; |
| 343 | -} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 344 | -]])],[dnl |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 345 | - AC_DEFINE(HAVE_SHM_MMAP_FILE, 1, [Define if you have mmap() SHM support]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 346 | - msg=yes],[msg=no],[msg=no]) |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 347 | - AC_MSG_RESULT([$msg]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 348 | + AC_DEFINE(HAVE_SHM_MMAP_FILE, 1, [Define if you have mmap() SHM support]) |
| 349 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 350 | PHP_NEW_EXTENSION(opcache, |
| 351 | ZendAccelerator.c \ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 352 | -- |
| 353 | 2.7.4 |
| 354 | |