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