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 eaccess) 14 15dnl Skip pathconf and fpathconf check on musl libc due to limited implementation 16dnl (first argument is not validated and has different error). 17 AS_IF([command -v ldd >/dev/null && ldd --version 2>&1 | grep ^musl >/dev/null 2>&1], 18 [], 19 [AC_CHECK_FUNCS(pathconf fpathconf)]) 20 21 AC_MSG_CHECKING([for working ttyname_r() implementation]) 22 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 23#include <unistd.h> 24 25int main(int argc, char *argv[]) 26{ 27 char buf[64]; 28 29 return !ttyname_r(0, buf, 64); 30} 31 ]])],[ 32 AC_MSG_RESULT([yes]) 33 AC_DEFINE(HAVE_TTYNAME_R, 1, [Whether you have a working ttyname_r]) 34 ],[ 35 AC_MSG_RESULT([no, posix_ttyname() will be thread-unsafe]) 36 ], [ 37 AC_MSG_RESULT([no, cannot detect working ttyname_r() when cross compiling. posix_ttyname() will be thread-unsafe]) 38 ]) 39 40 AC_CACHE_CHECK([for utsname.domainname], ac_cv_have_utsname_domainname, [ 41 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 42 #define _GNU_SOURCE 43 #include <sys/utsname.h> 44 ]],[[ 45 return sizeof(((struct utsname *)0)->domainname); 46 ]])],[ 47 ac_cv_have_utsname_domainname=yes 48 ],[ 49 ac_cv_have_utsname_domainname=no 50 ]) 51 ]) 52 if test "$ac_cv_have_utsname_domainname" = yes; then 53 AC_DEFINE(HAVE_UTSNAME_DOMAINNAME, 1, [Whether struct utsname has domainname]) 54 fi 55fi 56