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