Add a workaround for file.ftell() to raise IOError for ttys.
ftell(3) on BSD doesn't set errno even for ttys and returns useless
values.
diff --git a/configure.in b/configure.in
index 75a33a1..0550e4f 100644
--- a/configure.in
+++ b/configure.in
@@ -2955,6 +2955,28 @@
[Define if poll() sets errno on invalid file descriptors.])
fi
+AC_MSG_CHECKING(for broken ftell())
+AC_CACHE_VAL(ac_cv_broken_ftell, [
+AC_TRY_RUN([
+#include <stdio.h>
+int main()
+{
+ long val = ftell(stdin);
+ if (val != -1)
+ exit(0);
+ exit(1);
+}
+],
+ac_cv_broken_ftell=yes,
+ac_cv_broken_ftell=no,
+ac_cv_broken_ftell=no)])
+AC_MSG_RESULT($ac_cv_broken_ftell)
+if test "$ac_cv_broken_ftell" = yes
+then
+ AC_DEFINE(HAVE_BROKEN_FTELL, 1,
+ [Define if ftell() set errno on tty files.])
+fi
+
# Before we can test tzset, we need to check if struct tm has a tm_zone
# (which is not required by ISO C or UNIX spec) and/or if we support
# tzname[]