xref: /PHP-8.1/ext/posix/config.m4 (revision 9a3c8e51)
1PHP_ARG_ENABLE([posix],
2  [whether to enable POSIX-like functions],
3  [AS_HELP_STRING([--disable-posix],
4    [Disable POSIX-like functions])],
5  [yes])
6
7if test "$PHP_POSIX" = "yes"; then
8  AC_DEFINE(HAVE_POSIX, 1, [whether to include POSIX-like functions])
9  PHP_NEW_EXTENSION(posix, posix.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
10
11  AC_CHECK_HEADERS([sys/mkdev.h sys/sysmacros.h])
12
13  AC_CHECK_FUNCS(seteuid setegid setsid getsid getpgid ctermid mkfifo mknod setrlimit getrlimit getgroups makedev initgroups getgrgid_r)
14
15  AC_MSG_CHECKING([for working ttyname_r() implementation])
16  AC_RUN_IFELSE([AC_LANG_SOURCE([[
17#include <unistd.h>
18
19int main(int argc, char *argv[])
20{
21	char buf[64];
22
23	return !ttyname_r(0, buf, 64);
24}
25  ]])],[
26    AC_MSG_RESULT([yes])
27    AC_DEFINE(HAVE_TTYNAME_R, 1, [Whether you have a working ttyname_r])
28  ],[
29    AC_MSG_RESULT([no, posix_ttyname() will be thread-unsafe])
30  ], [
31    AC_MSG_RESULT([no, cannot detect working ttyname_r() when cross compiling. posix_ttyname() will be thread-unsafe])
32  ])
33
34  AC_CACHE_CHECK([for utsname.domainname], ac_cv_have_utsname_domainname, [
35    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
36      #define _GNU_SOURCE
37      #include <sys/utsname.h>
38    ]],[[
39      return sizeof(((struct utsname *)0)->domainname);
40    ]])],[
41      ac_cv_have_utsname_domainname=yes
42    ],[
43      ac_cv_have_utsname_domainname=no
44    ])
45  ])
46  if test "$ac_cv_have_utsname_domainname" = yes; then
47    AC_DEFINE(HAVE_UTSNAME_DOMAINNAME, 1, [Whether struct utsname has domainname])
48  fi
49fi
50