+ 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 <errno.h>
+ #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ # include <io.h>
+ #else
+ # include <unistd.h>
+ #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