blob: 9ffd0e4de1c9a782fd0aa3e0c6f2de40befaf6bf [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From fb139d9707dabe1684b472a08a6eb5761ede4a3a Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Tue, 12 Feb 2019 14:56:16 +0800
Brad Bishop316dfdd2018-06-25 12:45:53 -04004Subject: [PATCH] opcache/config.m4: enable opcache
5
6We can't use AC_TRY_RUN to run programs in a cross compile environment. Set
7the variables directly instead since we know that we'd be running on latest
8enough linux kernel.
9
10Upstream-Status: Inappropriate [Configuration]
11
12Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Brad Bishop19323692019-04-05 15:28:33 -040013
14update patch to version 7.3.2
15Signed-off-by: Changqing Li <changqing.li@windriver.com>
Brad Bishop316dfdd2018-06-25 12:45:53 -040016---
Brad Bishop19323692019-04-05 15:28:33 -040017 ext/opcache/config.m4 | 357 +-------------------------------------------------
18 1 file changed, 6 insertions(+), 351 deletions(-)
Brad Bishop316dfdd2018-06-25 12:45:53 -040019
20diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
Brad Bishop19323692019-04-05 15:28:33 -040021index 392f4c6..6617693 100644
Brad Bishop316dfdd2018-06-25 12:45:53 -040022--- a/ext/opcache/config.m4
23+++ b/ext/opcache/config.m4
Brad Bishop19323692019-04-05 15:28:33 -040024@@ -27,374 +27,29 @@ if test "$PHP_OPCACHE" != "no"; then
Brad Bishop316dfdd2018-06-25 12:45:53 -040025 AC_CHECK_HEADERS([unistd.h sys/uio.h])
26
Brad Bishop19323692019-04-05 15:28:33 -040027 AC_MSG_CHECKING(for sysvipc shared memory support)
28- AC_RUN_IFELSE([AC_LANG_SOURCE([[
Brad Bishop316dfdd2018-06-25 12:45:53 -040029-#include <sys/types.h>
30-#include <sys/wait.h>
31-#include <sys/ipc.h>
32-#include <sys/shm.h>
33-#include <unistd.h>
34-#include <string.h>
Brad Bishop19323692019-04-05 15:28:33 -040035-
Brad Bishop316dfdd2018-06-25 12:45:53 -040036-int main() {
37- pid_t pid;
38- int status;
39- int ipc_id;
40- char *shm;
41- struct shmid_ds shmbuf;
Brad Bishop19323692019-04-05 15:28:33 -040042-
Brad Bishop316dfdd2018-06-25 12:45:53 -040043- ipc_id = shmget(IPC_PRIVATE, 4096, (IPC_CREAT | SHM_R | SHM_W));
44- if (ipc_id == -1) {
45- return 1;
46- }
Brad Bishop19323692019-04-05 15:28:33 -040047-
Brad Bishop316dfdd2018-06-25 12:45:53 -040048- shm = shmat(ipc_id, NULL, 0);
49- if (shm == (void *)-1) {
50- shmctl(ipc_id, IPC_RMID, NULL);
51- return 2;
52- }
53-
54- if (shmctl(ipc_id, IPC_STAT, &shmbuf) != 0) {
55- shmdt(shm);
56- shmctl(ipc_id, IPC_RMID, NULL);
57- return 3;
58- }
59-
60- shmbuf.shm_perm.uid = getuid();
61- shmbuf.shm_perm.gid = getgid();
62- shmbuf.shm_perm.mode = 0600;
63-
64- if (shmctl(ipc_id, IPC_SET, &shmbuf) != 0) {
65- shmdt(shm);
66- shmctl(ipc_id, IPC_RMID, NULL);
67- return 4;
68- }
69-
70- shmctl(ipc_id, IPC_RMID, NULL);
71-
72- strcpy(shm, "hello");
73-
74- pid = fork();
75- if (pid < 0) {
76- return 5;
77- } else if (pid == 0) {
78- strcpy(shm, "bye");
79- return 6;
80- }
81- if (wait(&status) != pid) {
82- return 7;
83- }
84- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) {
85- return 8;
86- }
87- if (strcmp(shm, "bye") != 0) {
88- return 9;
89- }
90- return 0;
91-}
Brad Bishop19323692019-04-05 15:28:33 -040092-]])],[dnl
Brad Bishop316dfdd2018-06-25 12:45:53 -040093- AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support])
Brad Bishop19323692019-04-05 15:28:33 -040094- msg=yes],[msg=no],[msg=no])
Brad Bishop316dfdd2018-06-25 12:45:53 -040095- AC_MSG_RESULT([$msg])
Brad Bishop19323692019-04-05 15:28:33 -040096+ AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support])
97
98 AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support)
99- AC_RUN_IFELSE([AC_LANG_SOURCE([[
Brad Bishop316dfdd2018-06-25 12:45:53 -0400100-#include <sys/types.h>
101-#include <sys/wait.h>
102-#include <sys/mman.h>
103-#include <unistd.h>
104-#include <string.h>
105-
106-#ifndef MAP_ANON
107-# ifdef MAP_ANONYMOUS
108-# define MAP_ANON MAP_ANONYMOUS
109-# endif
110-#endif
111-#ifndef MAP_FAILED
112-# define MAP_FAILED ((void*)-1)
113-#endif
114-
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 Bishop19323692019-04-05 15:28:33 -0400145-]])],[dnl
Brad Bishop316dfdd2018-06-25 12:45:53 -0400146- AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support])
Brad Bishop19323692019-04-05 15:28:33 -0400147- msg=yes],[msg=no],[msg=no])
Brad Bishop316dfdd2018-06-25 12:45:53 -0400148- AC_MSG_RESULT([$msg])
Brad Bishop19323692019-04-05 15:28:33 -0400149+ AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support])
150
151 AC_MSG_CHECKING(for mmap() using /dev/zero shared memory support)
152- AC_RUN_IFELSE([AC_LANG_SOURCE([[
Brad Bishop316dfdd2018-06-25 12:45:53 -0400153-#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-
161-#ifndef MAP_FAILED
162-# define MAP_FAILED ((void*)-1)
163-#endif
164-
165-int main() {
166- pid_t pid;
167- int status;
168- int fd;
169- char *shm;
170-
171- fd = open("/dev/zero", O_RDWR, S_IRUSR | S_IWUSR);
172- if (fd == -1) {
173- return 1;
174- }
175-
176- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
177- if (shm == MAP_FAILED) {
178- return 2;
179- }
180-
181- strcpy(shm, "hello");
182-
183- pid = fork();
184- if (pid < 0) {
185- return 5;
186- } else if (pid == 0) {
187- strcpy(shm, "bye");
188- return 6;
189- }
190- if (wait(&status) != pid) {
191- return 7;
192- }
193- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) {
194- return 8;
195- }
196- if (strcmp(shm, "bye") != 0) {
197- return 9;
198- }
199- return 0;
200-}
Brad Bishop19323692019-04-05 15:28:33 -0400201-]])],[dnl
Brad Bishop316dfdd2018-06-25 12:45:53 -0400202- AC_DEFINE(HAVE_SHM_MMAP_ZERO, 1, [Define if you have mmap("/dev/zero") SHM support])
Brad Bishop19323692019-04-05 15:28:33 -0400203- msg=yes],[msg=no],[msg=no])
Brad Bishop316dfdd2018-06-25 12:45:53 -0400204- AC_MSG_RESULT([$msg])
Brad Bishop19323692019-04-05 15:28:33 -0400205+ AC_DEFINE(HAVE_SHM_MMAP_ZERO, 1, [Define if you have mmap("/dev/zero") SHM support])
206
207 AC_MSG_CHECKING(for mmap() using shm_open() shared memory support)
208- AC_RUN_IFELSE([AC_LANG_SOURCE([[
Brad Bishop316dfdd2018-06-25 12:45:53 -0400209-#include <sys/types.h>
210-#include <sys/wait.h>
211-#include <sys/mman.h>
212-#include <sys/stat.h>
213-#include <fcntl.h>
214-#include <unistd.h>
215-#include <string.h>
216-#include <stdlib.h>
217-#include <stdio.h>
218-
219-#ifndef MAP_FAILED
220-# define MAP_FAILED ((void*)-1)
221-#endif
222-
223-int main() {
224- pid_t pid;
225- int status;
226- int fd;
227- char *shm;
228- char tmpname[4096];
229-
230- sprintf(tmpname,"test.shm.%dXXXXXX", getpid());
231- if (mktemp(tmpname) == NULL) {
232- return 1;
233- }
234- fd = shm_open(tmpname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
235- if (fd == -1) {
236- return 2;
237- }
238- if (ftruncate(fd, 4096) < 0) {
239- close(fd);
240- shm_unlink(tmpname);
241- return 3;
242- }
243-
244- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
245- if (shm == MAP_FAILED) {
246- return 4;
247- }
248- shm_unlink(tmpname);
249- close(fd);
250-
251- strcpy(shm, "hello");
252-
253- pid = fork();
254- if (pid < 0) {
255- return 5;
256- } else if (pid == 0) {
257- strcpy(shm, "bye");
258- return 6;
259- }
260- if (wait(&status) != pid) {
261- return 7;
262- }
263- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) {
264- return 8;
265- }
266- if (strcmp(shm, "bye") != 0) {
267- return 9;
268- }
269- return 0;
270-}
Brad Bishop19323692019-04-05 15:28:33 -0400271-]])],[dnl
Brad Bishop316dfdd2018-06-25 12:45:53 -0400272- AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])
Brad Bishop19323692019-04-05 15:28:33 -0400273- msg=yes],[msg=no],[msg=no])
Brad Bishop316dfdd2018-06-25 12:45:53 -0400274- AC_MSG_RESULT([$msg])
275+ AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])
276
277 AC_MSG_CHECKING(for mmap() using regular file shared memory support)
Brad Bishop19323692019-04-05 15:28:33 -0400278- AC_RUN_IFELSE([AC_LANG_SOURCE([[
Brad Bishop316dfdd2018-06-25 12:45:53 -0400279-#include <sys/types.h>
280-#include <sys/wait.h>
281-#include <sys/mman.h>
282-#include <sys/stat.h>
283-#include <fcntl.h>
284-#include <unistd.h>
285-#include <string.h>
286-#include <stdlib.h>
287-#include <stdio.h>
288-
289-#ifndef MAP_FAILED
290-# define MAP_FAILED ((void*)-1)
291-#endif
292-
293-int main() {
294- pid_t pid;
295- int status;
296- int fd;
297- char *shm;
298- char tmpname[4096];
299-
300- sprintf(tmpname,"test.shm.%dXXXXXX", getpid());
301- if (mktemp(tmpname) == NULL) {
302- return 1;
303- }
304- fd = open(tmpname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
305- if (fd == -1) {
306- return 2;
307- }
308- if (ftruncate(fd, 4096) < 0) {
309- close(fd);
310- unlink(tmpname);
311- return 3;
312- }
313-
314- shm = mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
315- if (shm == MAP_FAILED) {
316- return 4;
317- }
318- unlink(tmpname);
319- close(fd);
320-
321- strcpy(shm, "hello");
322-
323- pid = fork();
324- if (pid < 0) {
325- return 5;
326- } else if (pid == 0) {
327- strcpy(shm, "bye");
328- return 6;
329- }
330- if (wait(&status) != pid) {
331- return 7;
332- }
333- if (!WIFEXITED(status) || WEXITSTATUS(status) != 6) {
334- return 8;
335- }
336- if (strcmp(shm, "bye") != 0) {
337- return 9;
338- }
339- return 0;
340-}
Brad Bishop19323692019-04-05 15:28:33 -0400341-]])],[dnl
Brad Bishop316dfdd2018-06-25 12:45:53 -0400342- AC_DEFINE(HAVE_SHM_MMAP_FILE, 1, [Define if you have mmap() SHM support])
Brad Bishop19323692019-04-05 15:28:33 -0400343- msg=yes],[msg=no],[msg=no])
Brad Bishop316dfdd2018-06-25 12:45:53 -0400344- AC_MSG_RESULT([$msg])
Brad Bishop19323692019-04-05 15:28:33 -0400345+ AC_DEFINE(HAVE_SHM_MMAP_FILE, 1, [Define if you have mmap() SHM support])
346
347 flock_type=unknown
348 AC_MSG_CHECKING(for struct flock layout)
349
350 if test "$flock_type" = "unknown"; then
351-AC_RUN_IFELSE([AC_LANG_SOURCE([[
352- #include <fcntl.h>
353- struct flock lock = { 1, 2, 3, 4, 5, 6, 7 };
354- int main() {
355- if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 6 && lock.l_len== 7) {
356- return 0;
357- }
358- return 1;
359- }
360-]])], [
361- flock_type=aix64
362- AC_DEFINE([HAVE_FLOCK_AIX64], [], [Struct flock is 64-bit AIX-type])
363-], [])
364-fi
Brad Bishop316dfdd2018-06-25 12:45:53 -0400365-
Brad Bishop19323692019-04-05 15:28:33 -0400366-if test "$flock_type" = "unknown"; then
367-AC_RUN_IFELSE([AC_LANG_SOURCE([[
Brad Bishop316dfdd2018-06-25 12:45:53 -0400368- #include <fcntl.h>
369- struct flock lock = { 1, 2, 3, 4, 5 };
Brad Bishop19323692019-04-05 15:28:33 -0400370- int main() {
Brad Bishop316dfdd2018-06-25 12:45:53 -0400371- if(lock.l_type == 1 && lock.l_whence == 2 && lock.l_start == 3 && lock.l_len == 4) {
372- return 0;
373- }
374- return 1;
Brad Bishop19323692019-04-05 15:28:33 -0400375- }
376-]])], [
Brad Bishop316dfdd2018-06-25 12:45:53 -0400377- flock_type=linux
Brad Bishop19323692019-04-05 15:28:33 -0400378+ flock_type=linux
379 AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type])
380-], [])
381 fi
Brad Bishop316dfdd2018-06-25 12:45:53 -0400382
Brad Bishop19323692019-04-05 15:28:33 -0400383 if test "$flock_type" = "unknown"; then
384-AC_RUN_IFELSE([AC_LANG_SOURCE([[
Brad Bishop316dfdd2018-06-25 12:45:53 -0400385- #include <fcntl.h>
386- struct flock lock = { 1, 2, 3, 4, 5 };
Brad Bishop19323692019-04-05 15:28:33 -0400387- int main() {
Brad Bishop316dfdd2018-06-25 12:45:53 -0400388- if(lock.l_start == 1 && lock.l_len == 2 && lock.l_type == 4 && lock.l_whence == 5) {
389- return 0;
390- }
391- return 1;
Brad Bishop19323692019-04-05 15:28:33 -0400392- }
393-]])], [
Brad Bishop316dfdd2018-06-25 12:45:53 -0400394- flock_type=bsd
Brad Bishop19323692019-04-05 15:28:33 -0400395- AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type])
396-], [])
397-fi
398-
399-AC_MSG_RESULT([$flock_type])
400-
401-if test "$flock_type" = "unknown"; then
Brad Bishop316dfdd2018-06-25 12:45:53 -0400402 AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no])
Brad Bishop19323692019-04-05 15:28:33 -0400403 fi
404
Brad Bishop316dfdd2018-06-25 12:45:53 -0400405--
4062.7.4
407