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