X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fptsname_r.m4;h=bc5adb7d5c61872b79a51b3c7a577f4244ae2eff;hb=03ea4328ae1ea7e985f7fd9a42ebf77bc64bd47c;hp=8dd07b1322d6e6a198dd241521f802b77213d93c;hpb=1602f0afed21be664fcf5c42d59db07cc22c56d6;p=gnulib.git diff --git a/m4/ptsname_r.m4 b/m4/ptsname_r.m4 index 8dd07b132..bc5adb7d5 100644 --- a/m4/ptsname_r.m4 +++ b/m4/ptsname_r.m4 @@ -1,4 +1,4 @@ -# ptsname_r.m4 serial 2 +# ptsname_r.m4 serial 3 dnl Copyright (C) 2010-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -46,5 +46,38 @@ AC_DEFUN([gl_FUNC_PTSNAME_R], # Prerequisites of lib/ptsname.c. AC_DEFUN([gl_PREREQ_PTSNAME_R], [ - : + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether isatty sets errno when it fails], + [gl_cv_func_isatty_sets_errno], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + # include + #else + # include + #endif + ]], + [[errno = 0; + isatty (-1); + return errno == 0; + ]]) + ], + [gl_cv_func_isatty_sets_errno=yes], + [gl_cv_func_isatty_sets_errno=no], + [case "$host_os" in + irix* | solaris* | mingw*) + gl_cv_func_isatty_sets_errno="guessing no";; + *) + gl_cv_func_isatty_sets_errno="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_isatty_sets_errno" in + *yes) ;; + *) + AC_DEFINE([ISATTY_FAILS_WITHOUT_SETTING_ERRNO], [1], + [Define to 1 if isatty() may fail without setting errno.]) + ;; + esac ])