mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Wrap ttyname_r check in AC_CACHE_CHECK (#14417)
This enables cross-compiling to set the php_cv_func_ttyname_r variable for adjusting the configuration manually. In case of cross-compiling the AC_CHECK_FUNCS is additionally used to guess whether the target has the ttyname_r. Current platforms mostly either have working ttyname_r compatible with POSIX or not.
This commit is contained in:
@@ -27,24 +27,20 @@ dnl (first argument is not validated and has different error).
|
||||
AS_IF([command -v ldd >/dev/null && ldd --version 2>&1 | grep -q "^musl"],[],
|
||||
[AC_CHECK_FUNCS(pathconf fpathconf)])
|
||||
|
||||
AC_MSG_CHECKING([for working ttyname_r() implementation])
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
return !ttyname_r(0, buf, 64);
|
||||
}
|
||||
]])],[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_TTYNAME_R, 1, [Whether you have a working ttyname_r])
|
||||
],[
|
||||
AC_MSG_RESULT([no, posix_ttyname() will be thread-unsafe])
|
||||
], [
|
||||
AC_MSG_RESULT([no, cannot detect working ttyname_r() when cross compiling. posix_ttyname() will be thread-unsafe])
|
||||
])
|
||||
AC_CACHE_CHECK([for working ttyname_r() implementation],
|
||||
[php_cv_func_ttyname_r],
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [[
|
||||
char buf[64];
|
||||
return !ttyname_r(0, buf, 64);
|
||||
]])],
|
||||
[php_cv_func_ttyname_r=yes],
|
||||
[php_cv_func_ttyname_r=no],
|
||||
[AC_CHECK_FUNC([ttyname_r],
|
||||
[php_cv_func_ttyname_r=yes], [php_cv_func_ttyname_r=no])])])
|
||||
AS_VAR_IF([php_cv_func_ttyname_r], [yes],
|
||||
[AC_DEFINE([HAVE_TTYNAME_R], [1],
|
||||
[Define to 1 if you have a working ttyname_r.])],
|
||||
[AC_MSG_NOTICE([posix_ttyname() will be thread-unsafe])])
|
||||
|
||||
AC_CHECK_MEMBERS([struct utsname.domainname],,,[
|
||||
#ifndef _GNU_SOURCE
|
||||
|
||||
Reference in New Issue
Block a user