2019-03-03 15:44:16 +00:00
|
|
|
PHP_ARG_ENABLE([posix],
|
|
|
|
[whether to enable POSIX-like functions],
|
|
|
|
[AS_HELP_STRING([--disable-posix],
|
|
|
|
[Disable POSIX-like functions])],
|
|
|
|
[yes])
|
1999-12-03 13:24:30 +00:00
|
|
|
|
|
|
|
if test "$PHP_POSIX" = "yes"; then
|
2024-08-01 23:41:47 +00:00
|
|
|
AC_DEFINE([HAVE_POSIX], [1],
|
|
|
|
[Define to 1 if the PHP extension 'posix' is available.])
|
2024-07-28 22:14:59 +00:00
|
|
|
PHP_NEW_EXTENSION([posix],
|
|
|
|
[posix.c],
|
|
|
|
[$ext_shared],,
|
|
|
|
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
|
2000-07-26 21:25:01 +00:00
|
|
|
|
2024-06-28 20:40:24 +00:00
|
|
|
AC_CHECK_FUNCS(m4_normalize([
|
|
|
|
ctermid
|
|
|
|
eaccess
|
|
|
|
getgrgid_r
|
|
|
|
getgroups
|
|
|
|
getpgid
|
|
|
|
getrlimit
|
|
|
|
getsid
|
|
|
|
initgroups
|
|
|
|
mkfifo
|
|
|
|
mknod
|
|
|
|
setegid
|
|
|
|
seteuid
|
|
|
|
setrlimit
|
|
|
|
setsid
|
|
|
|
]))
|
Check major, minor and makedev with Autoconf's AC_HEADER_MAJOR (#13706)
The non-standard major(), minor(), and makedev() can be defined as
macros. These are usually used together with the Autoconf macro
AC_HEADER_MAJOR, which defines the MAJOR_IN_MKDEV if sys/mkdev.h is
available, or MAJOR_IN_SYSMACROS if sys/sysmacros.h is available.
On Solaris/illumos they are in the sys/mkdev.h header (macro defined to
libc implementation) and in sys/sysmacros.h (macro defined with binary
operators and bits shifting). On systems with musl and glibc 2.28 or
later they are defined in sys/sysmacros.h, in glibc 2.27 and earlier
they were in sys/types.h. On BSD-based systems and macOS they are in the
sys/types.h.
Autoconf 2.70 has fixed the AC_HEADER_MAJOR macro, so it detects the
headers properly due to glibc 2.25 throwing deprecation warnings when
using the macros from sys/types.h. With Autoconf 2.69 and earlier the
ac_cv_header_sys_types_h_makedev cache variable can skip the
improper sys/types.h check in the macro.
This change syncs the usage within the ext/fileinfo/libmagic bundled
library and ext/posix.
When sys/mkdev.h header is available, code includes that, otherwise
it conditionally includes the sys/sysmacros.h. The ext/posix has
additional check whether linker sees the makedev, otherwise it checks
if makedev is declared within the given set of headers accoring to the
AC_HEADER_MAJOR logic. Previously the AC_CHECK_FUNCS didn't detect it.
2024-03-15 20:18:05 +00:00
|
|
|
|
|
|
|
dnl Check for makedev. If it's defined as a macro, AC_CHECK_FUNCS won't work.
|
|
|
|
dnl Required headers are included by the AC_HEADER_MAJOR logic.
|
|
|
|
AC_CHECK_FUNCS([makedev],,
|
|
|
|
[AC_CHECK_DECL([makedev], [AC_DEFINE([HAVE_MAKEDEV], [1])],, [
|
|
|
|
#include <sys/types.h>
|
|
|
|
#ifdef MAJOR_IN_MKDEV
|
|
|
|
# include <sys/mkdev.h>
|
|
|
|
#elif defined(MAJOR_IN_SYSMACROS)
|
|
|
|
# include <sys/sysmacros.h>
|
|
|
|
#endif
|
|
|
|
])])
|
2023-11-19 19:21:47 +00:00
|
|
|
|
|
|
|
dnl Skip pathconf and fpathconf check on musl libc due to limited implementation
|
|
|
|
dnl (first argument is not validated and has different error).
|
|
|
|
AS_IF([command -v ldd >/dev/null && ldd --version 2>&1 | grep -q "^musl"],[],
|
2024-06-28 20:40:24 +00:00
|
|
|
[AC_CHECK_FUNCS([pathconf fpathconf])])
|
2007-01-05 21:30:06 +00:00
|
|
|
|
2024-06-01 20:42:22 +00:00
|
|
|
AC_CACHE_CHECK([for working ttyname_r() implementation],
|
|
|
|
[php_cv_func_ttyname_r],
|
|
|
|
[AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [[
|
|
|
|
char buf[64];
|
|
|
|
return !ttyname_r(0, buf, 64);
|
|
|
|
]])],
|
|
|
|
[php_cv_func_ttyname_r=yes],
|
|
|
|
[php_cv_func_ttyname_r=no],
|
|
|
|
[AC_CHECK_FUNC([ttyname_r],
|
|
|
|
[php_cv_func_ttyname_r=yes], [php_cv_func_ttyname_r=no])])])
|
|
|
|
AS_VAR_IF([php_cv_func_ttyname_r], [yes],
|
|
|
|
[AC_DEFINE([HAVE_TTYNAME_R], [1],
|
|
|
|
[Define to 1 if you have a working ttyname_r.])],
|
|
|
|
[AC_MSG_NOTICE([posix_ttyname() will be thread-unsafe])])
|
2008-09-20 22:12:31 +00:00
|
|
|
|
2024-02-06 22:21:42 +00:00
|
|
|
AC_CHECK_MEMBERS([struct utsname.domainname],,,[
|
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
#define _GNU_SOURCE
|
|
|
|
#endif
|
|
|
|
#include <sys/utsname.h>
|
2008-09-20 22:12:31 +00:00
|
|
|
])
|
1999-12-03 13:24:30 +00:00
|
|
|
fi
|