Skip to content

Commit e72f0c8

Browse files
authored
Simplify prctl and procctl Autoconf checks (#13450)
The AC_CHECK_FUNCS checks whether the linker sees the function in the usual libraries, in this case libc. This is a simple trick to also check existence of belonging headers, since the code uses HAVE_PRCTL and HAVE_PROCCTL to include headers and call functions.
1 parent ba0f9fb commit e72f0c8

File tree

3 files changed

+5
-32
lines changed

3 files changed

+5
-32
lines changed

build/php.m4

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,32 +2679,6 @@ AC_DEFUN([PHP_PATCH_CONFIG_HEADERS], [
26792679
> $srcdir/$1.tmp && mv $srcdir/$1.tmp $srcdir/$1
26802680
])
26812681

2682-
dnl Check if we have prctl
2683-
AC_DEFUN([PHP_CHECK_PRCTL],
2684-
[
2685-
AC_MSG_CHECKING([for prctl])
2686-
2687-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/prctl.h>]], [[prctl(0, 0, 0, 0, 0);]])], [
2688-
AC_DEFINE([HAVE_PRCTL], 1, [do we have prctl?])
2689-
AC_MSG_RESULT([yes])
2690-
], [
2691-
AC_MSG_RESULT([no])
2692-
])
2693-
])
2694-
2695-
dnl Check if we have procctl
2696-
AC_DEFUN([PHP_CHECK_PROCCTL],
2697-
[
2698-
AC_MSG_CHECKING([for procctl])
2699-
2700-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/procctl.h>]], [[procctl(0, 0, 0, 0);]])], [
2701-
AC_DEFINE([HAVE_PROCCTL], 1, [do we have procctl?])
2702-
AC_MSG_RESULT([yes])
2703-
], [
2704-
AC_MSG_RESULT([no])
2705-
])
2706-
])
2707-
27082682
dnl
27092683
dnl PHP_CHECK_AVX512_SUPPORTS
27102684
dnl

configure.ac

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,6 @@ sys/file.h \
410410
sys/mman.h \
411411
sys/mount.h \
412412
sys/poll.h \
413-
sys/procctl.h \
414413
sys/resource.h \
415414
sys/select.h \
416415
sys/socket.h \
@@ -515,10 +514,6 @@ dnl Check __builtin_cpu_supports
515514
PHP_CHECK_BUILTIN_CPU_SUPPORTS
516515
dnl Check __builtin_frame_address
517516
PHP_CHECK_BUILTIN_FRAME_ADDRESS
518-
dnl Check prctl
519-
PHP_CHECK_PRCTL
520-
dnl Check procctl
521-
PHP_CHECK_PROCCTL
522517
dnl Check AVX512
523518
PHP_CHECK_AVX512_SUPPORTS
524519
dnl Check AVX512 VBMI
@@ -643,6 +638,10 @@ AC_CHECK_FUNC([inet_pton],,[AC_MSG_ERROR([Required inet_pton not found.])])
643638
dnl Check for strerror_r, and if its a POSIX-compatible or a GNU specific version.
644639
AC_FUNC_STRERROR_R
645640

641+
dnl Check for functions inside their belonging headers.
642+
AC_CHECK_HEADER([sys/prctl.h], [AC_CHECK_FUNCS([prctl])])
643+
AC_CHECK_HEADER([sys/procctl.h], [AC_CHECK_FUNCS([procctl])])
644+
646645
AX_FUNC_WHICH_GETHOSTBYNAME_R
647646

648647
dnl Some systems (like OpenSolaris) do not have nanosleep in libc.

ext/opcache/shared_alloc_mmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#endif
3535

3636
#include "zend_execute.h"
37-
#ifdef HAVE_SYS_PROCCTL_H
37+
#ifdef HAVE_PROCCTL
3838
#include <sys/procctl.h>
3939
#endif
4040

0 commit comments

Comments
 (0)