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], 9 [Define to 1 if the PHP extension 'posix' is available.]) 10 PHP_NEW_EXTENSION([posix], 11 [posix.c], 12 [$ext_shared],, 13 [-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1]) 14 15 AC_CHECK_FUNCS(m4_normalize([ 16 ctermid 17 eaccess 18 getgrgid_r 19 getgroups 20 getpgid 21 getrlimit 22 getsid 23 initgroups 24 mkfifo 25 mknod 26 setegid 27 seteuid 28 setrlimit 29 setsid 30 ])) 31 32 dnl Check for makedev. If it's defined as a macro, AC_CHECK_FUNCS won't work. 33 dnl Required headers are included by the AC_HEADER_MAJOR logic. 34 AC_CHECK_FUNCS([makedev],, 35 [AC_CHECK_DECL([makedev], [AC_DEFINE([HAVE_MAKEDEV], [1])],, [ 36 #include <sys/types.h> 37 #ifdef MAJOR_IN_MKDEV 38 # include <sys/mkdev.h> 39 #elif defined(MAJOR_IN_SYSMACROS) 40 # include <sys/sysmacros.h> 41 #endif 42 ])]) 43 44dnl Skip pathconf and fpathconf check on musl libc due to limited implementation 45dnl (first argument is not validated and has different error). 46 AS_IF([command -v ldd >/dev/null && ldd --version 2>&1 | grep ^musl >/dev/null 2>&1], 47 [], 48 [AC_CHECK_FUNCS([pathconf fpathconf])]) 49 50 AC_CACHE_CHECK([for working ttyname_r() implementation], 51 [php_cv_func_ttyname_r], 52 [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [[ 53 char buf[64]; 54 return !ttyname_r(0, buf, 64); 55 ]])], 56 [php_cv_func_ttyname_r=yes], 57 [php_cv_func_ttyname_r=no], 58 [AC_CHECK_FUNC([ttyname_r], 59 [php_cv_func_ttyname_r=yes], [php_cv_func_ttyname_r=no])])]) 60 AS_VAR_IF([php_cv_func_ttyname_r], [yes], 61 [AC_DEFINE([HAVE_TTYNAME_R], [1], 62 [Define to 1 if you have a working 'ttyname_r' function.])], 63 [AC_MSG_NOTICE([posix_ttyname() will be thread-unsafe])]) 64 65 AC_CHECK_MEMBERS([struct utsname.domainname],,,[ 66 #ifndef _GNU_SOURCE 67 #define _GNU_SOURCE 68 #endif 69 #include <sys/utsname.h> 70 ]) 71fi 72