Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c705dd8

Browse files
authored
Wrap FPM checks in AC_CACHE_CHECK and fix CS (#14681)
- This simplifies over-quoted arguments to AC_COMPILE_IFELSE - Indentation and other CS fixes - php_cv_* cache variables - AC_DEFINE help texts syncs to make it more clear - Fix -Wunused-but-set-variable warnings
1 parent fd28bb0 commit c705dd8

File tree

1 file changed

+91
-96
lines changed

1 file changed

+91
-96
lines changed

‎sapi/fpm/config.m4‎

Lines changed: 91 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -314,111 +314,106 @@ AC_DEFUN([PHP_FPM_LQ],
314314
])
315315

316316
AC_DEFUN([PHP_FPM_KQUEUE],
317-
[
318-
AC_MSG_CHECKING([for kqueue])
319-
320-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
321-
#include <sys/types.h>
322-
#include <sys/event.h>
323-
#include <sys/time.h>
324-
]], [[
325-
int kfd;
326-
struct kevent k;
327-
kfd = kqueue();
328-
/* 0 -> STDIN_FILENO */
329-
EV_SET(&k, 0, EVFILT_READ , EV_ADD | EV_CLEAR, 0, 0, NULL);
330-
]])],[
331-
AC_DEFINE([HAVE_KQUEUE], 1, [do we have kqueue?])
332-
AC_MSG_RESULT([yes])
333-
], [
334-
AC_MSG_RESULT([no])
335-
])
317+
[AC_CACHE_CHECK([for kqueue],
318+
[php_cv_have_kqueue],
319+
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
320+
#include <sys/types.h>
321+
#include <sys/event.h>
322+
#include <sys/time.h>
323+
], [dnl
324+
int kfd;
325+
struct kevent k;
326+
kfd = kqueue();
327+
/* 0 -> STDIN_FILENO */
328+
EV_SET(&k, 0, EVFILT_READ , EV_ADD | EV_CLEAR, 0, 0, NULL);
329+
(void)kfd;
330+
])],
331+
[php_cv_have_kqueue=yes],
332+
[php_cv_have_kqueue=no])])
333+
AS_VAR_IF([php_cv_have_kqueue], [yes],
334+
[AC_DEFINE([HAVE_KQUEUE], [1],
335+
[Define to 1 if system has a working 'kqueue' function.])])
336336
])
337337

338338
AC_DEFUN([PHP_FPM_DEVPOLL],
339-
[
340-
AC_MSG_CHECKING([for /dev/poll])
341-
342-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
343-
#include <stdio.h>
344-
#include <sys/devpoll.h>
345-
]], [[
346-
int n, dp;
347-
struct dvpoll dvp;
348-
dp = 0;
349-
dvp.dp_fds = NULL;
350-
dvp.dp_nfds = 0;
351-
dvp.dp_timeout = 0;
352-
n = ioctl(dp, DP_POLL, &dvp)
353-
]])],[
354-
AC_DEFINE([HAVE_DEVPOLL], 1, [do we have /dev/poll?])
355-
AC_MSG_RESULT([yes])
356-
], [
357-
AC_MSG_RESULT([no])
358-
])
339+
[AC_CACHE_CHECK([for /dev/poll],
340+
[php_cv_have_devpoll],
341+
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
342+
#include <stdio.h>
343+
#include <sys/devpoll.h>
344+
], [dnl
345+
int n, dp;
346+
struct dvpoll dvp;
347+
dp = 0;
348+
dvp.dp_fds = NULL;
349+
dvp.dp_nfds = 0;
350+
dvp.dp_timeout = 0;
351+
n = ioctl(dp, DP_POLL, &dvp);
352+
(void)n;
353+
])],
354+
[php_cv_have_devpoll=yes],
355+
[php_cv_have_devpoll=no])])
356+
AS_VAR_IF([php_cv_have_devpoll], [yes],
357+
[AC_DEFINE([HAVE_DEVPOLL], [1],
358+
[Define to 1 if system has a working '/dev/poll'.])])
359359
])
360360

361361
AC_DEFUN([PHP_FPM_EPOLL],
362-
[
363-
AC_MSG_CHECKING([for epoll])
364-
365-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
366-
#include <sys/epoll.h>
367-
]], [[
368-
int epollfd;
369-
struct epoll_event e;
370-
371-
epollfd = epoll_create(1);
372-
if (epollfd < 0) {
373-
return 1;
374-
}
375-
376-
e.events = EPOLLIN | EPOLLET;
377-
e.data.fd = 0;
378-
379-
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, 0, &e) == -1) {
380-
return 1;
381-
}
382-
383-
e.events = 0;
384-
if (epoll_wait(epollfd, &e, 1, 1) < 0) {
385-
return 1;
386-
}
387-
]])], [
388-
AC_DEFINE([HAVE_EPOLL], 1, [do we have epoll?])
389-
AC_MSG_RESULT([yes])
390-
], [
391-
AC_MSG_RESULT([no])
392-
])
362+
[AC_CACHE_CHECK([for epoll],
363+
[php_cv_have_epoll],
364+
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [dnl
365+
int epollfd;
366+
struct epoll_event e;
367+
368+
epollfd = epoll_create(1);
369+
if (epollfd < 0) {
370+
return 1;
371+
}
372+
373+
e.events = EPOLLIN | EPOLLET;
374+
e.data.fd = 0;
375+
376+
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, 0, &e) == -1) {
377+
return 1;
378+
}
379+
380+
e.events = 0;
381+
if (epoll_wait(epollfd, &e, 1, 1) < 0) {
382+
return 1;
383+
}
384+
])],
385+
[php_cv_have_epoll=yes],
386+
[php_cv_have_epoll=no])])
387+
AS_VAR_IF([php_cv_have_epoll], [yes],
388+
[AC_DEFINE([HAVE_EPOLL], [1], [Define to 1 if system has a working epoll.])])
393389
])
394390

395391
AC_DEFUN([PHP_FPM_SELECT],
396-
[
397-
AC_MSG_CHECKING([for select])
398-
399-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
400-
/* According to POSIX.1-2001 */
401-
#include <sys/select.h>
402-
403-
/* According to earlier standards */
404-
#include <sys/time.h>
405-
#include <sys/types.h>
406-
#include <unistd.h>
407-
]], [[
408-
fd_set fds;
409-
struct timeval t;
410-
t.tv_sec = 0;
411-
t.tv_usec = 42;
412-
FD_ZERO(&fds);
413-
/* 0 -> STDIN_FILENO */
414-
FD_SET(0, &fds);
415-
select(FD_SETSIZE, &fds, NULL, NULL, &t);
416-
]])], [
417-
AC_DEFINE([HAVE_SELECT], 1, [do we have select?])
418-
AC_MSG_RESULT([yes])
419-
], [
420-
AC_MSG_RESULT([no])
421-
])
392+
[AC_CACHE_CHECK([for select],
393+
[php_cv_have_select],
394+
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([dnl
395+
/* According to POSIX.1-2001 */
396+
#include <sys/select.h>
397+
398+
/* According to earlier standards */
399+
#include <sys/time.h>
400+
#include <sys/types.h>
401+
#include <unistd.h>
402+
], [dnl
403+
fd_set fds;
404+
struct timeval t;
405+
t.tv_sec = 0;
406+
t.tv_usec = 42;
407+
FD_ZERO(&fds);
408+
/* 0 -> STDIN_FILENO */
409+
FD_SET(0, &fds);
410+
select(FD_SETSIZE, &fds, NULL, NULL, &t);
411+
])],
412+
[php_cv_have_select=yes],
413+
[php_cv_have_select=no])])
414+
AS_VAR_IF([php_cv_have_select], [yes],
415+
[AC_DEFINE([HAVE_SELECT], [1],
416+
[Define to 1 if system has a working 'select' function.])])
422417
])
423418

424419
AC_MSG_CHECKING(for FPM build)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /