diff options
Diffstat (limited to 'gl/m4/lseek.m4')
| -rw-r--r-- | gl/m4/lseek.m4 | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4 index fd4f1f27..0bc3d65e 100644 --- a/gl/m4/lseek.m4 +++ b/gl/m4/lseek.m4 | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | # lseek.m4 serial 12 | 1 | # lseek.m4 |
| 2 | dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. | 2 | # serial 15 |
| 3 | dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
| 4 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
| 5 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
| @@ -13,13 +14,15 @@ AC_DEFUN([gl_FUNC_LSEEK], | |||
| 13 | AC_CHECK_HEADERS_ONCE([unistd.h]) | 14 | AC_CHECK_HEADERS_ONCE([unistd.h]) |
| 14 | AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], | 15 | AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], |
| 15 | [case "$host_os" in | 16 | [case "$host_os" in |
| 16 | mingw*) | 17 | mingw* | windows*) |
| 17 | dnl Native Windows. | 18 | dnl Native Windows. |
| 18 | dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or | 19 | dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or |
| 19 | dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) | 20 | dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) |
| 20 | dnl for a pipe depends on the environment: In a Cygwin 1.5 | 21 | dnl for a pipe depends on the environment: |
| 21 | dnl environment it succeeds (wrong); in a Cygwin 1.7 environment | 22 | dnl In a Cygwin 1.5 environment it succeeds (wrong); |
| 22 | dnl it fails with a wrong errno value. | 23 | dnl in a Cygwin 1.7 environment it fails with a wrong errno value; |
| 24 | dnl in a Cygwin 2.9.0 environment it fails correctly; | ||
| 25 | dnl in a Cygwin 3.4.6 environment it succeeds again (wrong). | ||
| 23 | gl_cv_func_lseek_pipe=no | 26 | gl_cv_func_lseek_pipe=no |
| 24 | ;; | 27 | ;; |
| 25 | *) | 28 | *) |
| @@ -70,9 +73,29 @@ AC_DEFUN([gl_FUNC_LSEEK], | |||
| 70 | REPLACE_LSEEK=1 | 73 | REPLACE_LSEEK=1 |
| 71 | fi | 74 | fi |
| 72 | 75 | ||
| 73 | dnl macOS SEEK_DATA is incompatible with other platforms. | 76 | AS_IF([test $REPLACE_LSEEK = 0], |
| 74 | case $host_os in | 77 | [AC_CACHE_CHECK([whether SEEK_DATA works but is incompatible with GNU], |
| 75 | darwin*) | 78 | [gl_cv_func_lseek_works_but_incompatible], |
| 76 | REPLACE_LSEEK=1;; | 79 | [AC_PREPROC_IFELSE( |
| 77 | esac | 80 | [AC_LANG_SOURCE( |
| 81 | dnl Use macOS "9999" to stand for a future fixed macOS version. | ||
| 82 | dnl See ../lib/unistd.in.h and <https://bugs.gnu.org/61386>. | ||
| 83 | [[#include <unistd.h> | ||
| 84 | #if defined __APPLE__ && defined __MACH__ && defined SEEK_DATA | ||
| 85 | # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ | ||
| 86 | # include <AvailabilityMacros.h> | ||
| 87 | # endif | ||
| 88 | # if 99990000 <= MAC_OS_X_VERSION_MIN_REQUIRED | ||
| 89 | # define LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU | ||
| 90 | # endif | ||
| 91 | #endif | ||
| 92 | #ifndef LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU | ||
| 93 | #error "No need to work around the bug" | ||
| 94 | #endif | ||
| 95 | ]])], | ||
| 96 | [gl_cv_func_lseek_works_but_incompatible=yes], | ||
| 97 | [gl_cv_func_lseek_works_but_incompatible=no])]) | ||
| 98 | if test "$gl_cv_func_lseek_works_but_incompatible" = yes; then | ||
| 99 | REPLACE_LSEEK=1 | ||
| 100 | fi]) | ||
| 78 | ]) | 101 | ]) |
