X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Fptsname_r.m4;h=bc5adb7d5c61872b79a51b3c7a577f4244ae2eff;hb=03ea4328ae1ea7e985f7fd9a42ebf77bc64bd47c;hp=695fe791b1ab543b9012ff6cb7d7ca5ded53aefd;hpb=f5562fca6f341accafc32a5285a0262625df0fde;p=gnulib.git diff --git a/m4/ptsname_r.m4 b/m4/ptsname_r.m4 index 695fe791b..bc5adb7d5 100644 --- a/m4/ptsname_r.m4 +++ b/m4/ptsname_r.m4 @@ -1,5 +1,5 @@ -# ptsname_r.m4 serial 2 -dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. +# 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, dnl with or without modifications, as long as this notice is preserved. @@ -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 ])