Skip to content

Simplify port_create Autoconf check #13529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions sapi/fpm/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -352,27 +352,6 @@ AC_DEFUN([AC_FPM_KQUEUE],
])
])

AC_DEFUN([AC_FPM_PORT],
[
AC_MSG_CHECKING([for port framework])

AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <port.h>
]], [[
int port;

port = port_create();
if (port < 0) {
return 1;
}
]])], [
AC_DEFINE([HAVE_PORT], 1, [do we have port framework?])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
])

AC_DEFUN([AC_FPM_DEVPOLL],
[
AC_MSG_CHECKING([for /dev/poll])
Expand Down Expand Up @@ -468,7 +447,6 @@ if test "$PHP_FPM" != "no"; then
AC_FPM_BUILTIN_ATOMIC
AC_FPM_LQ
AC_FPM_KQUEUE
AC_FPM_PORT
AC_FPM_DEVPOLL
AC_FPM_EPOLL
AC_FPM_SELECT
Expand All @@ -477,6 +455,7 @@ if test "$PHP_FPM" != "no"; then

AC_CHECK_HEADER([priv.h], [AC_CHECK_FUNCS([setpflags])])
AC_CHECK_HEADER([sys/times.h], [AC_CHECK_FUNCS([times])])
AC_CHECK_HEADER([port.h], [AC_CHECK_FUNCS([port_create])])

PHP_ARG_WITH([fpm-user],,
[AS_HELP_STRING([[--with-fpm-user[=USER]]],
Expand Down
12 changes: 6 additions & 6 deletions sapi/fpm/fpm/events/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "../fpm.h"
#include "../zlog.h"

#ifdef HAVE_PORT
#ifdef HAVE_PORT_CREATE

#include <port.h>
#include <poll.h>
Expand All @@ -45,19 +45,19 @@ port_event_t *events = NULL;
int nevents = 0;
static int pfd = -1;

#endif /* HAVE_PORT */
#endif /* HAVE_PORT_CREATE */

struct fpm_event_module_s *fpm_event_port_module(void) /* {{{ */
{
#ifdef HAVE_PORT
#ifdef HAVE_PORT_CREATE
return &port_module;
#else
return NULL;
#endif /* HAVE_PORT */
#endif /* HAVE_PORT_CREATE */
}
/* }}} */

#ifdef HAVE_PORT
#ifdef HAVE_PORT_CREATE

/*
* Init the module
Expand Down Expand Up @@ -196,4 +196,4 @@ static int fpm_event_port_remove(struct fpm_event_s *ev) /* {{{ */
}
/* }}} */

#endif /* HAVE_PORT */
#endif /* HAVE_PORT_CREATE */