summaryrefslogtreecommitdiffstats
path: root/gl/m4/ftello.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/ftello.m4')
-rw-r--r--gl/m4/ftello.m430
1 files changed, 21 insertions, 9 deletions
diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4
index 4901b16..0eb8fa0 100644
--- a/gl/m4/ftello.m4
+++ b/gl/m4/ftello.m4
@@ -1,5 +1,6 @@
1# ftello.m4 serial 14 1# ftello.m4
2dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. 2# serial 16
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -37,13 +38,24 @@ AC_DEFUN([gl_FUNC_FTELLO],
37 if test $gl_cv_var_stdin_large_offset = no; then 38 if test $gl_cv_var_stdin_large_offset = no; then
38 REPLACE_FTELLO=1 39 REPLACE_FTELLO=1
39 fi 40 fi
41 AC_REQUIRE([AC_CANONICAL_HOST])
42 if test $REPLACE_FTELLO = 0; then
43 dnl On native Windows, in some circumstances, ftell(), ftello(),
44 dnl fgetpos(), lseek(), _lseeki64() all succeed on devices of type
45 dnl FILE_TYPE_PIPE. However, to match POSIX behaviour, we want
46 dnl ftell(), ftello(), fgetpos(), lseek() to fail when the argument fd
47 dnl designates a pipe. See also
48 dnl https://github.com/python/cpython/issues/78961#issuecomment-1093800325
49 case "$host_os" in
50 mingw* | windows*) REPLACE_FTELLO=1 ;;
51 esac
52 fi
40 if test $REPLACE_FTELLO = 0; then 53 if test $REPLACE_FTELLO = 0; then
41 dnl Detect bug on Solaris. 54 dnl Detect bug on Solaris.
42 dnl ftell and ftello produce incorrect results after putc that followed a 55 dnl ftell and ftello produce incorrect results after putc that followed a
43 dnl getc call that reached EOF on Solaris. This is because the _IOREAD 56 dnl getc call that reached EOF on Solaris. This is because the _IOREAD
44 dnl flag does not get cleared in this case, even though _IOWRT gets set, 57 dnl flag does not get cleared in this case, even though _IOWRT gets set,
45 dnl and ftell and ftello look whether the _IOREAD flag is set. 58 dnl and ftell and ftello look whether the _IOREAD flag is set.
46 AC_REQUIRE([AC_CANONICAL_HOST])
47 AC_CACHE_CHECK([whether ftello works], 59 AC_CACHE_CHECK([whether ftello works],
48 [gl_cv_func_ftello_works], 60 [gl_cv_func_ftello_works],
49 [ 61 [
@@ -51,12 +63,12 @@ AC_DEFUN([gl_FUNC_FTELLO],
51 dnl be opened. 63 dnl be opened.
52changequote(,)dnl 64changequote(,)dnl
53 case "$host_os" in 65 case "$host_os" in
54 # Guess no on Solaris. 66 # Guess no on Solaris.
55 solaris*) gl_cv_func_ftello_works="guessing no" ;; 67 solaris*) gl_cv_func_ftello_works="guessing no" ;;
56 # Guess yes on native Windows. 68 # Guess yes on native Windows.
57 mingw*) gl_cv_func_ftello_works="guessing yes" ;; 69 mingw* | windows*) gl_cv_func_ftello_works="guessing yes" ;;
58 # Guess yes otherwise. 70 # Guess yes otherwise.
59 *) gl_cv_func_ftello_works="guessing yes" ;; 71 *) gl_cv_func_ftello_works="guessing yes" ;;
60 esac 72 esac
61changequote([,])dnl 73changequote([,])dnl
62 AC_RUN_IFELSE( 74 AC_RUN_IFELSE(